I even set the timer interval to 1 millisecond and yet some new file events were missing. Private void timer_Tick(object sender, EventArgs e) StringBuilder.Remove(0, stringBuilder.Length) code to create a watcher and allow it to reise events. Private void btnWatchFile_Click(object sender, EventArgs e) Copying several files only triggers 1 onCreated event StringBuilder.Append(e.ChangeType.ToString()) Public void onCreated(object sender, FileSystemEventArgs e) Watcher.Created += new FileSystemEventHandler(onCreated) Watcher.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.FileName Watcher = new System.IO.FileSystemWatcher(directory) Private void watchForChanges(string directory) I've messed with the watcher's internal buffer and its notify filters but nothing seems to work.Īny help, tips, suggestions will be trully appreciated.
The problem is when more than one file are copied at the same time, the watcher triggers only 1 onCreated event instead of one event for each file. I've coded an app using this great example to monitor when files are copied to a directory and it works just fine when files are copied one by one.