private static void Backup(string[] args, Configuration configuration, DateTime timestamp) { log.Info("backup an inventory"); if (args.Length != 3) { log.Error("wrong number of command line args"); Environment.Exit(-1); } DirectoryInfo originDir = new DirectoryInfo(args[1]); if (!originDir.Exists) { log.Error("origin does not exists"); Environment.Exit(-1); } DirectoryInfo targetDir = new DirectoryInfo(args[2]); if (targetDir.Exists) { log.Info("target folder exist \"" + originDir.FullName + "\""); } else { log.Info("target does not exist, creating folder \"" + targetDir.FullName + "\""); targetDir.Create(); } log.Info("creating inventory for " + originDir.FullName); Inventory i = Inventory.FromFileSystem(originDir, configuration); log.Info("inventory created"); string file = i.Save(timestamp); log.Info("init target " + targetDir.FullName); ObjectStorage store = new ObjectStorage(targetDir, configuration); log.Info("start backup"); store.Backup(i, timestamp); log.Info("finished backup"); }