FileSystemWatcher Created Event Triggers Early

P

Phil Galey

I have a FileSystemWatcher that triggers when a PDF file is created.
However, the creation of the PDF file is about a 7 or 8 second process ... I
cannot refer to the file during that time because it does not yet exist. If
I set up a loop using the Sleep API call, it loops forever and the software
that creates the PDF file stops progressing and the file never finishes
getting created. The FileSystemWatcher was triggered only on the beginning
of the process.

Is it possible to use the FileSystemWatcher to trigger when a file is
created and not just conceived?
 
G

Guest

Hi

Well you can try monitering both the Created and the Changed events of the FileWatcher for the PDB File.

The documentation of the Changed event states
The change of a file or folder. The types of changes include: changes to size, attributes, security settings, last write, and last access time.

So this event will fire when there is change to *size* which should happen after the process of compilation is compelete.
 
G

Guest

Hi

Well you can try monitering both the Created and the Changed events of the FileWatcher for the PDB File.

The documentation of the Changed event states
The change of a file or folder. The types of changes include: changes to size, attributes, security settings, last write, and last access time.

So this event will fire when there is change to *size* which should happen after the process of compilation is compelete.
 

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

Top