Re: How to know when file is finished being written to?
- From: David Brown <david.brown@xxxxxxxxx>
- Date: Fri, 12 May 2006 23:51:34 +0000 (UTC)
Hello Ryk,
maybe search for an open file handle?
There is a utility called "Handle" at www.sysinternals.com which is a command line utility that will show which processes have a file handle in use. As a worst case, you may be able to call that utility, and parse the output for the file you're looking for.
In theory, if the file is in use it is locked. You could set up a loop that attempts to move the file to a different directory or simply rename it. It should fail until the file is unlocked. That would work so long as FTP doesn't unlock/relock the file prior to completion of the download.
I also found a suggestion to attempt to open the file for append, if it succeeds, the file has been closed.
http://www.codecomments.com/archive300-2005-1-351008.html
I have Googled all afternoon & can't figure out how to definitely
determine when a file has finished being written to.
I'm writing a script that will copy several files after they've been
FTP'ed to our site. I can determine when they're all present, but not
when they're finally complete.
I tried polling the size for changes, but a quick and dirty test seems
to indicate that the file size can indicate the complete size before
the file is fully written.
Has anyone solved this one? And asking the sender to change their
routine (as in, sending a file flag file, etc.) is not an option.
.
- Prev by Date: Need a List of Objects and their Methods and Properties
- Next by Date: Re: Need a List of Objects and their Methods and Properties
- Previous by thread: Need a List of Objects and their Methods and Properties
- Next by thread: Re: How to know when file is finished being written to?
- Index(es):
Relevant Pages
|