create_paths.py 454 B

123456789101112131415161718192021222324
  1. # create paths
  2. import zipfly
  3. import os
  4. parent = "/home/user/Documents/folder/"
  5. paths = []
  6. # Create paths
  7. for dirpath, dnames, fnames in os.walk(parent):
  8. for f in fnames:
  9. paths.append(
  10. {
  11. 'fs': f'{parent}{f}',
  12. 'n': f'large_folder/{f}',
  13. }
  14. )
  15. # ZipFly
  16. zfly = zipfly.ZipFly( paths = paths )
  17. with open("large.zip", "wb") as f:
  18. for i in zfly.generator():
  19. f.write(i)