Testing for complete uploaded file

Carsten Gehling carsten at gehling.dk
Mon May 26 06:26:56 EDT 2003


A user uploads to my server with ftp.

I'm writing a "daemon" to process those files. I do this by checking for new
files in the upload folder, process them, and finally delete them. This is
all done in a loop, that pauses for a few seconds between each check.

However since some of the files takes maybe a few minutes to upload, I only
want to process them AFTER the upload os complete.

I thought that the files might be write-protected during upload, and that I
therefore could use:
	try: ftest = open(uploaded_filename, "w")
	except: return
	else: ftest.close()

but they are not. The above call to open() does not generate an exception
even if the file is still being uploaded.

What should I do instead?

BTW: I use ProFTPD, so if any settings in the ftpd can solve the problem,
I'm open for suggestions here too.

- Carsten






More information about the Python-list mailing list