BuildScript/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py

15 lines
414 B
Python

import os
import shutil
from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand
class DeleteBackupCommand(BaseBackupCommand):
def __init__(self):
BaseBackupCommand.__init__(self)
def execute(self):
if not os.path.exists(self.backupDirAbsPath):
raise Exception('backup folder: {0} not exists'.format(self.backupDirAbsPath))
shutil.rmtree(self.backupDirAbsPath, ignore_errors=True)