FileSystemWatcher files in subdirectory

后端 未结 3 1573
借酒劲吻你
借酒劲吻你 2021-01-04 20:40

I\'m trying to be notified if a file is created, copied, or moved into a directory i\'m watching. I only want to be notified about the files though, not the directories.

3条回答
  •  天命终不由人
    2021-01-04 20:57

    Copying and moving folders

    The operating system and FileSystemWatcher object interpret a cut-and-paste action or a move action as a rename action for a folder and its contents. If you cut and paste a folder with files into a folder being watched, the FileSystemWatcher object reports only the folder as new, but not its contents because they are essentially only renamed.

    Reference: MSDN

提交回复
热议问题