Added Registry backups to system_checklist cleanup

This commit is contained in:
2Shirt 2018-08-19 13:12:03 -07:00
parent 4f2f696d60
commit 42c5e918b6
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 27 additions and 0 deletions

View file

@ -104,6 +104,31 @@ def cleanup_emsisoft():
if os.path.exists(source_path): if os.path.exists(source_path):
shutil.rmtree(source_path) shutil.rmtree(source_path)
def cleanup_regbackups():
"""Move d7ii regbackups into backup folder."""
source_path = r'{}\Support\RegBackups'.format(
global_vars['Env']['SYSTEMDRIVE'])
# Bail early
if not os.path.exists(source_path):
return
# Move to backup folder
for entry in os.scandir(source_path):
os.makedirs(global_vars['ProgBackupDir'], exist_ok=True)
dest_path = r'{ProgBackupDir}\{Date}\Registry\{name}'.format(
name=entry.name,
**global_vars)
dest_path = non_clobber_rename(dest_path)
shutil.move(entry.path, dest_path)
# Delete source folders if empty
try:
os.rmdir(source_path)
os.rmdir(r'{}\Support'.format(global_vars['Env']['SYSTEMDRIVE']))
except OSError:
pass
if __name__ == '__main__': if __name__ == '__main__':
print("This file is not meant to be called directly.") print("This file is not meant to be called directly.")

View file

@ -50,6 +50,8 @@ if __name__ == '__main__':
function=cleanup_desktop, cs='Done') function=cleanup_desktop, cs='Done')
try_and_print(message='Emsisoft a2cmd...', try_and_print(message='Emsisoft a2cmd...',
function=cleanup_emsisoft, cs='Done') function=cleanup_emsisoft, cs='Done')
try_and_print(message='Registry Backup(s)...',
function=cleanup_regbackups, cs='Done')
# Export system info # Export system info
if not D7_MODE: if not D7_MODE: