Esempio n. 1
0
 public static void InitializeVSS()
 {
     using (VssBackup vss = new VssBackup())
     {
         string backupPath = @"F:\";
         string sourceFile = @"E:\Daten\Doku\DokuMandandtassistent.docx";
         vss.Setup(Path.GetPathRoot(sourceFile));
         slLogger.WriteLogLine("Getting VSS-SnapshotPath");
         string snapPath = vss.GetSnapshotPath(sourceFile);
         slLogger.WriteLogLine("Backup " + sourceFile + " To " + backupPath);
         File.Copy(snapPath, backupPath);
     }
 }
Esempio n. 2
0
        public void BackupFromShadow(string sourceFile, string DestinationPath = null)
        {
            using (VssBackup vss = new VssBackup())
            {
                string backupPath = "";
                if (DestinationPath.IsNullOrEmpty())
                {
                    backupPath = Path.Combine(backupRootDir, Path.GetFileName(sourceFile));
                }
                else
                {
                    backupPath = Path.Combine(DestinationPath, Path.GetFileName(sourceFile));
                }

                slLogger.WriteLogLine("Getting VSS-Setup");
                vss.Setup(Path.GetPathRoot(sourceFile));
                slLogger.WriteLogLine("Getting VSS-SnapshotPath");
                string snapPath = vss.GetSnapshotPath(sourceFile);
                slLogger.WriteLogLine("Backup " + sourceFile + " To " + backupPath);
                File.Copy(snapPath, backupPath);
            }
        }