restore backup
This commit is contained in:
parent
15eafc716c
commit
30c2024c1b
11
hlna.py
11
hlna.py
@ -72,9 +72,8 @@ def restore(g,d):
|
|||||||
directory_to_extract_to = "*******"
|
directory_to_extract_to = "*******"
|
||||||
"Получение пути к файлам внутри архива, может понадобиться при раскидывании по местам"
|
"Получение пути к файлам внутри архива, может понадобиться при раскидывании по местам"
|
||||||
"==================================================================================="
|
"==================================================================================="
|
||||||
zip_files_paths = zipfile.ZipFile(d)
|
with zipfile.ZipFile(d, 'r') as zip_file:
|
||||||
files = [text_file.filename for text_file in zip_files_paths.infolist()]
|
files = zip_file.namelist()
|
||||||
print(files)
|
|
||||||
"===================================================================================="
|
"===================================================================================="
|
||||||
|
|
||||||
"Извлечение файлов"
|
"Извлечение файлов"
|
||||||
@ -84,12 +83,10 @@ def restore(g,d):
|
|||||||
s = i.split("/")
|
s = i.split("/")
|
||||||
s.pop(-1)
|
s.pop(-1)
|
||||||
s = "/"+'/'.join(s)+'/' # вот тут где-то еще надо начало пути проверить и если home_dir другой заменить
|
s = "/"+'/'.join(s)+'/' # вот тут где-то еще надо начало пути проверить и если home_dir другой заменить
|
||||||
print(s)
|
print(i,colorama.Fore.GREEN + "- перемещен" + colorama.Style.RESET_ALL )
|
||||||
absolute_path = os.path.abspath(s)
|
|
||||||
zip_file.extract(i, '/')
|
zip_file.extract(i, '/')
|
||||||
|
|
||||||
"======================="
|
"======================="
|
||||||
"Извлечение из архива всего скорее всего не пригодится"
|
"Извлечение из архива всего, скорее всего не пригодится"
|
||||||
#with zipfile.ZipFile(d, 'r') as zip_file:
|
#with zipfile.ZipFile(d, 'r') as zip_file:
|
||||||
# zip_file.extractall(directory_to_extract_to)
|
# zip_file.extractall(directory_to_extract_to)
|
||||||
"--------------------------"
|
"--------------------------"
|
||||||
|
Loading…
Reference in New Issue
Block a user