Is file open/closed? 
Author Message
 Is file open/closed?

Quote:

>    Hi All!

>  Some days ago I made a small script that adds newly uploaded file to
> special list (in fact it's a homepage with links to new files). After
> the script moves (by executing "system mv" command) file to another dir
> (accessed by httpd). All seems to work fine but one. Files are uploaded
> via ftp by dialup users and my script is executed from crontab each
> minute. So main question is: "HOW CAN I FIND IF THE FILE IS OPEN (BEING
> STILL UPLOADED) AND SKIP IT?".
>  I saw alike message in this newsgroup but can't make flock work. Even
> if the file is open mv moves it and flock seems to function without error!
> But I need error!
>  Please, be so kind, and drop me a couple of lines explaining the method.

If you are using Unix, look at fuser.  It should tell you which process
is using the file.  I'm not sure how standard fuser is, so you might
want to avoid any features that look really snazzy if you think you may
need to port it later.

- doug



Fri, 14 Jan 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Filehandle: open(FILE) while{} close(FILE)

2. open() close() same file many times

3. Question: Opening and closing files.

4. Spooling open file via http til close...

5. Problem with open/closing parsing a file

6. Opening and closing dbm files from subroutines?

7. open() not closing open filehandle before reopening

8. Am I kind of close to solving this?

9. PERLFUNC: close - close file (or pipe or socket) handle

10. PERLFUNC: close - close file (or pipe or socket) handle

11. open FILE,$path || open FILE,$altpath;

12. CGI.pm Bug: file upload file size mismatch when file size is close to buffer size

 

 
Powered by phpBB® Forum Software