Zip / Compress a file that is located on Google Drive

I want to compress some folders In Google Drive. Does anyone know the Python or Google Colab method for file compression in Gdrive?

  1. Section 1: mount your Google Drive
  2. Section 2: install zip and unzip commands
    !apt-get update
    !apt-get install zip
  3. Section 3:
  • zip folder

    !zip -r /content/My\ Drive/{Your folder}
  • zip folder with level 9 encryption

    !zip -r -9 /content/My\ Drive/{Your folder}

Remember! Google Collab is running in Linux environment, every files and folders that have spaces must have backslash β€œ\” placed before them.


please check eror

In linux terminal, you must place backslash β€œ\” before every spaces

β€œ/content/My Drive” ==> β€œ/content/My\ Drive/”

1 Like

Use this


Can I unzip something on GD? using a script.

sure, you can unzip

search how to use on Google

1 Like