public static async Task CleanUp() { Console.WriteLine("Watcher is running..."); // Find existing files var files = Directory.EnumerateFiles(SettingsController.DownloadFolder, "*").ToList(); Console.WriteLine($"Found: {files.Count()} files."); foreach (var file in files) { Console.WriteLine(file); try { await MoveFile(file); } catch (Exception ex) { LoggerController.PrintException(ex); } } Console.WriteLine("Watcher is done."); }
public static void OnError(object sender, ErrorEventArgs e) => LoggerController.PrintException(e.GetException());
public static void OnRenamed(object sender, RenamedEventArgs e) { LoggerController.Log($"Renamed:\n Old: {e.OldFullPath}\nNew: {e.FullPath}"); MoveFile(e.FullPath); }