Excel files are dropped manually into a local folder, there is a FileWatcher which converts the file into a new filestructure and moves it to the next folder which also have a filewatcher. The problem is that when this file is moved to the next folder the filewatcher does not fire any event. However if i cut it and drop it physically the event fires. I am using File.Move to copy file from folder1 to folder2
Asked
Active
Viewed 732 times
1
-
1Add your code please. – Samvel Petrosov May 18 '17 at 10:05
-
What do you mean by "new filestructure"? Maybe a duplicate of http://stackoverflow.com/questions/11468637/filesystemwatcher-not-raising-when-files-are-copied-or-moved-to-folder – Renier May 18 '17 at 10:07
2 Answers
2
you should look at FileSystemWatcher detect when file is moved to folder
Actually when there is a move, the filesystemwatcher send a delete (in the source directory watcher) and a create (in the target directory watcher).

Community
- 1
- 1

Robin Camus
- 91
- 10
0
try to use renamed event.
Another reason could be the buffer size may exceeded.
Public void WatchItBaby()
{
// ...
FileSystemWatcher watcher = new FileSystemWatcher(@"c:\temp\", "*.txt");
watcher.Created += new FileSystemEventHandler(OnChangedOrRenamed);
watcher.Renamed += new RenamedEventHandler(OnChangedOrRenamed);
watcher.EnableRaisingEvents = true;
// ...
}
private void OnChangedOrRenamed(object source, FileSystemEventArgs e)
{
// stuff
}

Dinch
- 548
- 4
- 9