waiting for file lock?

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Apr 11 03:07:19 EDT 2006


In article <1144725394.174399.4030 at j33g2000cwa.googlegroups.com>,
 s99999999s2003 at yahoo.com wrote:

>i need to go into a directory to grab some files and do some
>processing.
>The thing is, i need to wait till the process that generates the files
>in that directory to finish
>before i can grab the files. eg if file A is being generated and has
>not finished, my python script will not go into the directory.
>how can i check that file A has actually finished?

I wrote a similar system that watches for new files arriving in an 
"uploads" directory, whether copied there via FTP or using a GUI desktop 
script. My heuristic was to only process files whose last-modified 
date/time was at least 5 minutes in the past. My assumption was that it 
was unlikely that 5 minutes would go by between more information being 
added to a file.



More information about the Python-list mailing list