views:

153

answers:

1

I'm watching a directory using FileSystemWatcher.

When a file is copied into that directory - my watcher grabs it and performs multiple actions with it.

My problem is that when a Microsoft Office file is opened, a temporary file is created in the watched directory. I can't find a way to ignore these files.

Though the temporary file name is well known (i.e. abcd.docx --> ~$cd.docx), I need a better way than this to identify that file.

Any ideas?

+1  A: 

These temporary files are marked as hidden.

Therefore, you can ignore all hidden files. (Call File.GetAttributes)

SLaks
Nice... didn't notice this... I'll simply combine both the attributes and the filename test.Thanks
Nissim