I am using a Windows Forms application to monitor a directory and move files falling into it to another directory.
At the moment, it will copy the file to another directory, but when another file is added, it simply will not end the error message. Sometimes it copies two files until the end of the third.
Is it because I'm using a Windows Form application and not a console application? Is there any way to stop the program and continue browsing the directory?
private void watch() { FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = path; watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName; watcher.Filter = "*.*"; watcher.Changed += new FileSystemEventHandler(OnChanged); watcher.EnableRaisingEvents = true; } private void OnChanged(object source, FileSystemEventArgs e) {
c # io copy winforms filesystemwatcher
cheeseman Feb 22 '13 at 5:30 2013-02-22 05:30
source share