Uploading multiple files to Google Drive through Google Colab

I need to know whether there’s a way to download multiple files to Google Drive (without downloading on PC then uploading on G Drive).

I know there’s this way which can download any file to Google Drive via Google colab. But it only downloads single file at a time.

What I want is something sort of same but multiple file on a single go through Google Colab.

1 Like

Download Files with Wget

# donwload 5 MB file
!wget http://ipv4.download.thinkbroadband.com/5MB.zip
# download 10 MB file
!wget http://ipv4.download.thinkbroadband.com/10MB.zip

Copy files to drive

#copy all files on your colab root directory to Google drive
!cp *.* drive/My\ Drive

or

# copy all zip files on your colab root directory to Google drive
!cp *.zip drive/My\ Drive

Files copied to Drive

image

Copy whole folder to drive

# copy all files of a folder to new folder
!cp -a download/. drive/My\ Drive/aaa

image

Tips:

  1. You can use basic Linux commands to copy and move files in colab with “!” as perfix.

  2. Use wget to download files if you are not doing much coding or API stuff.

  3. I personally prefer arai2. Install it by using

    sudo apt-get install -y aria2

  4. Documentation link - https://aria2.github.io/manual/en/html/aria2c.html

1 Like

try using cyberduck

Hi, thanks for this amazing method. Zip method worked, but when I tried copying non-zip file it said something like this

1 Like

My bad the editor was removed some star characters.
It should be
!cp *.* drive/My\ Drive
The first * represents any filename
The second * represents any extension
Wildcards -

It seems like you’re trying to copy a directory, in this case you should include the flag -r. The full command should be:

!cp -r -a . drive/My\ Drive

where:

cp: the copy command
-a: preserve the original file structure/attributes
-r: recursive flag, meaning include all items inside the folder
. (dot): a command to say include all items in the current directory
drive/My\ Drive: the target directory

Can you give that Kochikame cartoon pls :smile:

Friendly Websites

https://pirateiro.com/ https://igg-games.com/ ettvdl.com https://dodi-repacks.site/ https://crackingpatching.com/ https://glodls.to/ https://prostylex.org/ https://haxnode.com/ https://freedownloadae.com/ https://www.novahax.com/ freecoursesonline.me ftuapps.dev