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?

2 Likes
  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 test.zip /content/My\ Drive/{Your folder}
    
  • zip folder with level 9 encryption

    !zip -r -9 test.zip /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.

4 Likes

please check eror

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

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

1 Like

Use this

4 Likes

Can I unzip something on GD? using a script.

sure, you can unzip

search how to use on Google

1 Like