Monitor the increase of file size

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Two processes query a disk file's file size, concurrently and frequently (in
a loop), using the following lines:

FileInfo objFileSize = new FileInfo(fileToCheck);
outputFileSize = objFileSize.Length;

Only one of them writes to the file. And the file size is keeping increasing
all the time.

However, a stange behavior led us to suspect that though the file size is
increasing, one of the process monitoring its changes doesn't catching it
sometimes?

Any idea?

Thanks!
 
I can't say for sure but have you tried the System.IO.FileSystemWatcher
class to get change events instead of polling the size? I've not had any
problems doing it this way.

Jayme
 

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