开发者

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 开发者_C百科not find when I should move these file to the network drive.


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

check this FileAttributes


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜