static void OnChanged(object source, FileSystemEventArgs e) { string fileName = Path.GetFileNameWithoutExtension(e.FullPath); string destination; // Setting destination path switch (e.GetFileType()) { case FileType.Image: destination = imagesDestinationPath; break; case FileType.Text: destination = textsDestinationPath; break; case FileType.App: destination = appsDestinationPath; break; case FileType.Other: destination = defaultDestinationPath; break; case FileType.Icon: destination = iconsDestinationPath; break; default: destination = defaultDestinationPath; break; } string path = e.FullPath; // If directory was added if (Directory.Exists(path)) { MoveDirectory(path, destination, fileName); } // If file was added else if (File.Exists(path)) { MoveFile(path, destination, fileName); } }