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
|
# Wizard Kit: Functions - Windows updates
|
||||||
|
|
||||||
|
import pathlib
|
||||||
|
|
||||||
from functions.common import *
|
from functions.common import *
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -63,6 +65,10 @@ def disable_windows_updates():
|
||||||
indent=indent, width=width,
|
indent=indent, width=width,
|
||||||
function=delete_folder, folder_path=folder_path)
|
function=delete_folder, folder_path=folder_path)
|
||||||
if not result['CS']:
|
if not result['CS']:
|
||||||
|
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))
|
raise GenericError('Failed to remove folder {}'.format(folder_path))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue