Determining when a file has finished copying
motoom at xs4all.nl
Mon Jul 14 18:30:26 CEST 2008
> One more option may be to attempt to rename
> the file -- if it's still open for copying, that will fail;
> success indicates the copy is done.
Caveat -- this is dependent on the operating system!
Windows will indeed not allow you to rename or delete a file that's still
open for writing by another process, at least not when the file is on a
local NTFS filesystem, but don't count on this on Unix or networked
filesystems. There you can easily rename, move or delete a filename from a
directory whilst other processes still write to it. After all, a directory
is nothing else than a list of filenames which map to certain inodes.
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
More information about the Python-list