views:

107

answers:

2

Hello I'm watching a directory using FileSystemWatcher.

When a file is created into that directory - my watcher grabs and transfers it to the network drive. 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 and also could not find when I should move these file to the network drive.

A: 

Temporary files have file attribute that cite it. You can check for this attribute if the FileInfo.Attributes

check this FileAttributes

Itay
+2  A: 

If I'm not mistaking, those temporary files are hidden files. If that doesn't work, you might consider allowing files with special names (those temporary files start with a tilde ~) to be ignored by your program. Using Regular Expressions you could set more "ignore masks" like that.

deltreme