Example #1
0
        private static void RestoreFile(string[] args, Configuration configuration)
        {
            log.Info("restore a single file from inventory");
            if (args.Length != 4)
            {
                log.Error("wrong number of command line args");
                Environment.Exit(-1);
            }

            FileInfo inventoryFile = new FileInfo(args[1]);

            if (!inventoryFile.Exists)
            {
                log.Error("origin does not exists");
                Environment.Exit(-1);
            }

            DirectoryInfo targetDir = new DirectoryInfo(args[2]);

            if (targetDir.Exists)
            {
                log.Error("target already exists");
                Environment.Exit(-1);
            }

            log.Info("loading inventory " + inventoryFile.FullName);
            Inventory     i     = Inventory.FromXml(inventoryFile, configuration);
            ObjectStorage store = new ObjectStorage(inventoryFile.Directory, configuration);

            log.Info("target" + targetDir.FullName);

            string partialRestorePath = args[3];

            log.Info("start file restore: " + partialRestorePath);
            store.FileRestore(i, targetDir, partialRestorePath);

            log.Info("finished restore");
        }