Check for file access

Brian Bull bbull at pathfire.com
Tue Jan 14 09:56:29 EST 2003


I am writing a daemon to monitor file uploads and mirror the files to
another server once they have been uploaded.  The files will be
uploaded via Windows filesharing onto my Redhat server that is running
Samba.  How can I tell when the file is complete and is ready for
copying?

I am using a kernel module called 'changedfiles' that alerts me when a
file is changed.  The only problem is this modules alerts me when the
file operation begins, not when it ends.  The files that will be
uploaded are CD images so they will be very large, so I have to have
some sort of way to "wait" until the file is complete.

I have tried opening the file (with read and write permission), but
that cancels the upload process.  I guess Windows loses the access to
the file once the server grabs it.

I have also tried checking the size of the file, but that doesn't work
because the complete size is reported from the first second the file
is being uploaded.

Any help here would be really appreciated.  If I am not describing
this well, let me know and I will try to elaborate more.




More information about the Python-list mailing list