writeson wrote:
Hi all,

I'm writing some code that monitors a directory for the appearance of
files from a workflow. When those files appear I write a command file
to a device that tells the device how to process the file. The
appearance of the command file triggers the device to grab the
original file. My problem is I don't want to write the command file to
the device until the original file from the workflow has been copied
completely. Since these files are large, my program has a good chance
of scanning the directory while they are mid-copy, so I need to
determine which files are finished being copied and which are still
mid-copy.

I haven't seen anything on Google talking about this, and I don't see
an obvious way of doing this using the os.stat() method on the
filepath. Anyone have any ideas about how I might accomplish this?

Thanks in advance!
Doug

The best way to do this is to have the program that copies the files copy them to a temporarily named file and rename it when it is completed. That way you know when it is done by scanning for files with a specific mask.

If that is not possible you might be able to use pyinotify (http://pyinotify.sourceforge.net/) to watch for WRITE_CLOSE events on the directory and then process the files.

-Larry

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to