def do_backup(self): ''' Do a backup of the file if asked, and change his creation/access date ''' if self.backup is False: mat.secure_remove(self.filename) os.rename(self.output, self.filename)
def __del__(self): """ Remove the files inside the temp dir, then remove the temp dir """ for root, _, files in os.walk(self.tempdir): for item in files: path_file = os.path.join(root, item) mat.secure_remove(path_file) shutil.rmtree(self.tempdir)
def do_backup(self): """ Keep a backup of the file if asked. The process of double-renaming is not very elegant, but it greatly simplify new strippers implementation. """ if self.backup: shutil.move(self.filename, os.path.join(self.filename, '.bak')) else: mat.secure_remove(self.filename) shutil.move(self.output, self.filename)
def do_backup(self): """ Keep a backup of the file if asked. The process of double-renaming is not very elegant, but it greatly simplify new strippers implementation. """ if self.backup: shutil.move(self.filename, self.filename + '.bak') else: mat.secure_remove(self.filename) shutil.move(self.output, self.filename)
def do_backup(self): ''' Keep a backup of the file if asked. The process of double-renaming is not very elegant, but it greatly simplify new strippers implementation. ''' if self.backup: os.rename(self.filename, self.filename + '.bak') else: mat.secure_remove(self.filename) os.system("mv \"" + self.output + "\" \"" + self.filename + "\"")
def __del__(self): """ Remove tempfile if it was not used """ if os.path.exists(self.output): mat.secure_remove(self.output)