Example #1
0
        static int DirSuperBackup(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[src]",       ConsoleService.Prompt, "Source directory path: ",      ConsoleService.EvalNotEmpty, null),
                new ConsoleParam("dst",         ConsoleService.Prompt, "Destination directory path: ", ConsoleService.EvalNotEmpty, null),
                new ConsoleParam("errorlog"),
                new ConsoleParam("infolog"),
                new ConsoleParam("ignoredirs"),
            };

            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            string src        = vl.DefaultParam.StrValue;
            string dst        = vl["dst"].StrValue;
            string errorlog   = vl["errorlog"].StrValue;
            string infolog    = vl["infolog"].StrValue;
            string ignoredirs = vl["ignoredirs"].StrValue;

            bool err = false;

            try
            {
                Lfs.EnableBackupPrivilege();
            }
            catch (Exception ex)
            {
                Con.WriteError(ex);
            }

            using (var b = new DirSuperBackup(new DirSuperBackupOptions(Lfs, infolog, errorlog)))
            {
                Async(async() =>
                {
                    await b.DoSingleDirBackupAsync(src, dst, default, ignoredirs);