Программа архивирует папку с сохранением структуры подпапках
import zipfile import os folderPath = 'D:'+ os.sep + 'docker' + os.sep + 'python' + os.sep +'app' + os.sep zipPath = 'D:'+ os.sep + 'docker' + os.sep + 'python' + os.sep+'app' + os.sep + 'files' + os.sep + 'new.zip' zipName = 'new.zip' archive = zipfile.ZipFile(zipPath,'w') # archive.write(folderPath + 'test_db.sqlite', arcname = '1.db', compress_type=zipfile.ZIP_DEFLATED) for folder, subfolders , files in os.walk(folderPath): print(folder, subfolders , files) for file in files: if file == zipName: continue archive.write(os.path.join(folder, file), os.path.relpath(os.path.join(folder, file), folderPath), compress_type=zipfile.ZIP_DEFLATED) archive.close()