static void Main(string[] args) { try { string filename = DateTime.Now.ToString("MMddTHHmmss") + "_listing.txt"; List <FileInformation> files1 = new List <FileInformation>(); List <DirectoryInformation> directories1 = new List <DirectoryInformation>(); if (args.Length != 2) { Usage(); } else { if (!Directory.Exists(args[0])) { Console.WriteLine("Error: Directory \"{0}\" not found.\n", args[0]); Usage(); } if (!Directory.Exists(args[1])) { Console.WriteLine("Error: Output directory \"{0}\" not found.\n", args[1]); Usage(); } Log.Logger logger = new Log.Logger(Path.Combine(args[1], filename)); while (!FindNextFilePInvokeRecursiveParalleled(args[0], out files1, out directories1, logger)) { Thread.Sleep(1000); } files1.Sort((a, b) => string.Compare(a.FullPath, b.FullPath)); directories1.Sort((a, b) => string.Compare(a.FullPath, b.FullPath)); foreach (var filedata in files1) { logger.WriteLine(filedata.ToString()); } foreach (var filedata in directories1) { logger.WriteLine(filedata.ToString()); } logger.Close(); CompressFile(args[1] + "\\" + filename); Console.WriteLine("Done!"); } } catch (Exception exception) { //TODO: If I crash I will not output the listing Console.WriteLine(exception.Message); Console.WriteLine(exception.StackTrace); } }