user350610
user350610

Reputation: 1

Watching a directory using FileSystemWatcher

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.

Upvotes: 0

Views: 996

Answers (2)

C.Evenhuis
C.Evenhuis

Reputation: 26446

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.

Upvotes: 2

Itay Karo
Itay Karo

Reputation: 18306

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

check this FileAttributes

Upvotes: 2

Related Questions