перед созданием бэкапа старую папку удаляем

This commit is contained in:
rzaitov 2013-11-13 14:16:02 +04:00
parent 7c7f786a76
commit ad05a6980f
1 changed files with 5 additions and 2 deletions

View File

@ -8,11 +8,14 @@ class CreateBackupCommand(BaseBackupCommand):
BaseBackupCommand.__init__(self)
def execute(self):
if os.path.exists(self.backupDirAbsPath):
raise Exception('folder: {0} already exists'.format(self.backupDirAbsPath))
#if os.path.exists(self.backupDirAbsPath):
# raise Exception('folder: {0} already exists'.format(self.backupDirAbsPath))
dirContent = os.listdir(self.srcAbsDirPath)
if os.path.exists(self.backupDirAbsPath):
shutil.rmtree(self.backupDirAbsPath)
os.mkdir(self.backupDirAbsPath)
for fileOrDir in dirContent: