将存档拆分为具有最大卷文件大小的卷

时间:2017-07-05 10:28:49

标签: python python-3.x

如何创建存档test.zip,将其分解为具有最大卷文件大小的卷

import os, zipfile

def zip_dir(path, zp):
    for entry in os.scandir(path):
        zp.write(entry.path)
        if entry.is_dir(follow_symlinks=False):
            zip_dir(entry.path, zp)

if __name__ == '__main__':
    max_size = 1024  # ?
    with zipfile.ZipFile('test.zip', 'w', zipfile.ZIP_DEFLATED) as zp:
        zip_dir('libs', zp)
        zip_dir('.idea', zp)

0 个答案:

没有答案