0

I'm working with FileSystemWatcher to track opened files. But I have a question, why it doesn't fire the events for opened files. I included Changed, Created, Delete, and Renamed Events but they doesn't fire when files are opened. Well in case of docx it watch a ~!me.docx that is a temporal file. It just works when the file is created or saved.

There is not a Opened event in the class, may be this class is not used to watch opened files??

Can you help me with this issue please. I need to watch just opened files. I'm using Win7 x64 I have this filters: FileName, attributes, lastAccess, LastWrite,

Majid
  • 13,853
  • 15
  • 77
  • 113
Jio
  • 97
  • 9
  • You'd have to watch file handles for this, – It'sNotALie. Aug 10 '13 at 18:14
  • You include `changed`, `created`, `deleted` and `renamed` events, but are surprised that you won't receive anything for `opened` files? – user1908061 Aug 10 '13 at 18:19
  • No, you can't use FileSystemWatcher to be notified on OPEN file events. See here http://stackoverflow.com/questions/14779616/filesystemwatcher-used-to-watch-for-folder-file-open?rq=1 – Steve Aug 10 '13 at 18:21

2 Answers2

0

Seems that you can't use FileSystemWatcher for what you want, and you need to work with Win32 function ReadDirectoryChangesW.

Community
  • 1
  • 1
Saeed Neamati
  • 35,341
  • 41
  • 136
  • 188
0

The link Steve posted in the comments was useful. FileSystemWatcher watches for opened files, but we have to enable the Lass Access TimeStamp on Windows. Now I have to evaluate the performace of this. Thanks Steve.

Jio
  • 97
  • 9