FileSystemWatcher vs polling to watch for file changes

后端 未结 13 2306
一个人的身影
一个人的身影 2020-11-22 05:44

I need to setup an application that watches for files being created in a directory, both locally or on a network drive.

Would the FileSystemWatcher or p

13条回答
  •  礼貌的吻别
    2020-11-22 05:54

    I had some big problems with FSW on network drives: Deleting a file always threw the error event, never the deleted event. I did not find a solution, so I now avoid the FSW and use polling.

    Creation events on the other hand worked fine, so if you only need to watch for file creation, you can go for the FSW.

    Also, I had no problems at all on local folders, no matter if shared or not.

提交回复
热议问题