Try renaming update folder(s) if deletion fails
This commit is contained in:
parent
54654a73bd
commit
ae475a04f2
1 changed files with 7 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
|||
# Wizard Kit: Functions - Windows updates
|
||||
|
||||
import pathlib
|
||||
|
||||
from functions.common import *
|
||||
|
||||
|
||||
|
|
@ -63,7 +65,11 @@ def disable_windows_updates():
|
|||
indent=indent, width=width,
|
||||
function=delete_folder, folder_path=folder_path)
|
||||
if not result['CS']:
|
||||
raise GenericError('Failed to remove folder {}'.format(folder_path))
|
||||
try:
|
||||
new_path = pathlib.path(folder_path).with_suffix('.bak')
|
||||
os.rename(folder_path, new_path)
|
||||
except OSError:
|
||||
raise GenericError('Failed to remove folder {}'.format(folder_path))
|
||||
|
||||
|
||||
def enable_service(service_name, start_type='auto'):
|
||||
|
|
|
|||
Loading…
Reference in a new issue