WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
Page Index Toggle Pages: 1
problems capturing MS Office apps file events (Read 2608 times)
YaBB Newbies

I love YaBB 1G - SP1!

Posts: 1
problems capturing MS Office apps file events
Mar 3rd, 2004 at 12:40am
We are doing some tests with watchdir and we have detected the following problem with MS Office applications. When you create one document and save it, the watchdir DOES NOT  capture the event of creating this document (and the file is in the folder). This event is only capture WHEN you close the application (or close the file).  Is it right?
Back to top
IP Logged
YaBB Administrator

Posts: 2268
The Netherlands
Re: problems capturing MS Office apps file events
Reply #1 - Mar 3rd, 2004 at 1:17am

Some applications, and most office applications as you noticed, lock the file they create or change. They do this to prevent other applications to change the file without them knowing it. Other applications (MS Access comes to mind) also do this because the file is not in a consistent state until they close it.

watchDirectory notices that the file is locked and, by default, will wait until the file is unlocked.

In a lot of cases this makes sense: suppose you want to use watchDirectory to copy new/changed files to another location... You wouldn't want to copy 'half-written' files. Also, if you intend to use the COPY command for this copy-action, it will fail (COPY does not copy locked files).

For other cases, the way watchDirectory handles this might not be perfect. If you want to send an email for example. You don't care about the file contents, but just want to notify somebody of the change.

Now for the good news: you can tell watchDirectory to ignore locked files (call your .bat file immediately when the files is created or a change is detected). To enable this behavior you must set the option "Don't wait for files to be available" - corresponding to the command line option /c.

Hope this makes sense,
Back to top

Gert Rijs - gert (at) gdpsoftware (dot) com
End Alzheimer's:
WWW WWW GdPSoftware  
IP Logged
Page Index Toggle Pages: 1