0

So I want to zip only the subfolders inside a parent directory and the contents inside the sub folders. I have copied those folders and moved them to another directory in the below code. I do not want to zip the parent directory but only the individual sub folders.

Parent
 ->A.Zip
   ->Contents
 ->B.Zip
   ->Contents

Below is the code

import zipfile
import os
import sys
import shutil

from distutils.dir_util import copy_tree
copy_tree(r'\\trekk\arcgis\Standards\Tools_and_Scripts\ZipFolderTools\Original_Raw_Data', r'\\trekk\arcgis\Standards\Tools_and_Scripts\ZipFolderTools\Processed_Sample')
  • You are probably looking for [`os.walk`](https://docs.python.org/3/library/os.html#os.walk) – Tomerikoo Feb 12 '20 at 18:10
  • 1
    Does this answer your question? [Python: zip all folders in directory](https://stackoverflow.com/questions/34153166/python-zip-all-folders-in-directory) – Tomerikoo Feb 12 '20 at 18:12

0 Answers0