Форум сайта python.su
4kpt_IV
shutil.make_archive(path_dst, 'zip', path_src)
Отредактировано ivn (Янв. 15, 2017 20:14:29)
Офлайн
Да. Верно.
Офлайн
немного кода из zipfile.py
... if date_time[0] < 1980: raise ValueError('ZIP does not support timestamps before 1980') ... mtime = time.localtime(st.st_mtime) date_time = mtime[0:6] ...
# -*- coding: utf-8 -*- import os import time DIR_OF_BACKUP = 'J:\\' T = [] def read(DIR_OF_BACKUP, T): try: print('пошел процесс чтения атрибутов') for root, dirs, files in os.walk(DIR_OF_BACKUP): for file in files: path = os.path.join(root, file) print(path) date_of_files = time.localtime(os.stat(path).st_mtime) print(date_of_files[0]) if date_of_files[0] < 1980: print(path, '-' * 200) T.append(str(path) + ' ' + str(date_of_files)) return T except Exception as err: msg = 'чтение не удалось' print(msg) print(err) read(DIR_OF_BACKUP, T) if T: print(T)
Отредактировано ivn (Янв. 16, 2017 19:47:53)
Офлайн