how to handle two events at the same time with fileSystemWatcher with .net code example
Example: c# filesystemwatcher double events
//Inside the OnChanged Method
void OnChanged(object source, FileSystemEventArgs e)
{
DateTime lastWriteTime = File.GetLastWriteTime(@"PathToCheck");
if (lastWriteTime != lastRead)
{
if (File.Exists(destPath))
{
File.Delete(destPath);
}
File.Move(sourcePath, destPath);
lastRead = lastWriteTime;
}
}