Re: How to know when file is finished being written to?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.



.



Relevant Pages

  • Re: input devices in matlab
    ... I want know how you can write a command in ... matlab\uitools - Graphical user interface tools. ... uiopen - Show open file dialog and call OPEN on result. ...
    (comp.soft-sys.matlab)
  • Re: input devices in matlab
    ... I want know how you can write a command in ... > the editor to input data when you run the code. ... matlab\uitools - Graphical user interface tools. ... uiopen - Show open file dialog and call OPEN on result. ...
    (comp.soft-sys.matlab)
  • Re: Save As command in Access VBA
    ... "SaveCopyAs" command, which saves a copy of the currently open file to ... for each tdf in cdb.Tabledefs ... ' correct but you can check that in the help files ...
    (microsoft.public.access.modulesdaovba)
  • Re: executing shell commands
    ... the shell command as a list of lines. ... >@ fileId FileId must be the identifier for an open file, ... Standard ...
    (comp.lang.tcl)
  • Re: running other applications
    ... Does MatLab have a command or maybe there is a way that I could write ... MatLab to supply the correct input file. ... same file name once I excute the bang command and run the other file? ... certain file into the open file window then excutes that command. ...
    (comp.soft-sys.matlab)