filesystemwatcher and determining when it is safe to work on the directory

  • Thread starter Thread starter topher
  • Start date Start date
T

topher

When using filesystemwatcher to keep an eye on a directory to see if
there are any files, how will I know when it is safe to work on the
files in a directory? In other words, how will I know that no more
files are being written and that the directory is static?

-topher
 
You cant know that nobody is writing a file exactly. You could check to see
whether there are any open handles to the directory or files in the
directory. I dont know how to do this exactly but if I had to, I would look
at the source code to the ForceDelete tool that floats around the web and
this finds file handles and closes them with WinAPI calls.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top