Skip to content

Instantly share code, notes, and snippets.

@ZeccaLehn
Last active November 17, 2017 02:16
Show Gist options
  • Save ZeccaLehn/61b73077d780a56d40cdda6dfe383a1a to your computer and use it in GitHub Desktop.
Save ZeccaLehn/61b73077d780a56d40cdda6dfe383a1a to your computer and use it in GitHub Desktop.
Download all files within directory tree in Python

Creating Zips

import shutil
import os

cwd = os.getcwd()

zip_name = 'test' # Name of .zip
directory_name = cwd # Current working dir where .zip downloads to

# Create 'path\to\test.zip'
shutil.make_archive(zip_name, 'zip', directory_name)

Similar to the linux/unix tar version (can run from .ipynb -- note "!")

!tar cvfz test.tar.gz *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment