Handling multiple Change Events in FileSystemWatcher

后端 未结 7 1801
别跟我提以往
别跟我提以往 2021-02-10 09:33

I have the following sub:

  Private Sub Watcher_Changed(ByVal sender As System.Object, ByVal e As FileSystemEventArgs)
        If Path.GetExtension(e.Name) = \".         


        
7条回答
  •  天命终不由人
    2021-02-10 10:04

    I had this same issue, I was saving a file that was uploaded through code and deleting and creating would fire twice each time. All I had to check was that the File was there before doing my processing.

    private void fsw_Created(object sender, FileSystemEventArgs e)
    {
       if (File.Exists(e.FullPath))
       {
          //process the file here
       }
    }
    

提交回复
热议问题