Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Closed 1

Status
Not open for further replies.

Killa

Programmer
Oct 19, 2001
56
US
Is there a way to see if a file has finished being written to?


Back Ground



I'm writing a program in visual basic to monitor a windows directory then process any files that appear there but it must ensure that the file has finished being written before proceeding


any help would be much appreciated
 
Attempt to call CreateFile in exclusive mode in a loop. If you succeed, the file is done being written to.

(you'll want to wait 250 milliseconds or so between checks so you don't hammer the system responsiveness)

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
chiph, thanks. I've been working on a different problem where I need to know when an application has finished working with a file. With Word and Access thats been easy, but with Excel, Powerpoint and Visio I've been stumped. Your solution is so simple and so obvious, too obvious that it did not even occur to me.

Thanks again and a star for your genius.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top