# Uploading multiple files to Google Drive through Google Colab

**URL:** <https://onehack.st/t/uploading-multiple-files-to-google-drive-through-google-colab/161730>\
**Category:** Discussion & Solutions\
**Tags:** solved\
**Created:** [November 8, 2020, 8:17am UTC](https://onehack.st/t/uploading-multiple-files-to-google-drive-through-google-colab/161730 "2020-11-08T08:17:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aarkay\_Pathak](https://onehack.st/letter_avatar_proxy/v4/letter/a/439d5e/32.png) [@Aarkay\_Pathak](https://onehack.st/u/Aarkay_Pathak)\
**Post date:** [November 8, 2020, 8:17am UTC](https://onehack.st/t/uploading-multiple-files-to-google-drive-through-google-colab/161730/1 "2020-11-08T08:17:41Z")

</div>

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](https://onehack.st/t/download-anything-to-google-drive-using-google-colab/73228) 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.

---

<div class="post-metadata">

**Author:** ![ayush1920](https://onehack.st/user_avatar/onehack.st/ayush1920/32/38568_2.png) [@ayush1920](https://onehack.st/u/ayush1920)\
**Post date:** [November 8, 2020, 10:52am UTC](https://onehack.st/t/uploading-multiple-files-to-google-drive-through-google-colab/161730/2 "2020-11-08T10:52:54Z")

</div>

# 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

```

 ![image](https://onehack.st/uploads/default/original/3X/7/e/7e513cc93a1030e94f869f4d4caa5d15a7b2e276.png)

# 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](https://onehack.st/uploads/default/original/3X/b/6/b66d13846a21c36953d6748e628ad4aa22473117.png)

# Copy whole folder to drive

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

```

 ![image](https://onehack.st/uploads/default/original/3X/2/3/23800d31843713c3255111193339009f547909ae.png)

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

4. Documentation link - [https://aria2.github.io/manual/en/html/aria2c.html](https://aria2.github.io/manual/en/html/aria2c.html)

---

<div class="post-metadata">

**Author:** ![Aarkay\_Pathak](https://onehack.st/letter_avatar_proxy/v4/letter/a/439d5e/32.png) [@Aarkay\_Pathak](https://onehack.st/u/Aarkay_Pathak)\
**Post date:** [November 8, 2020, 2:24pm UTC](https://onehack.st/t/uploading-multiple-files-to-google-drive-through-google-colab/161730/4 "2020-11-08T14:24:49Z")

</div>

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

 ![image](https://onehack.st/uploads/default/original/3X/a/d/adae204fab1100173ef6013c013c93c83b1868ea.png)

---

<div class="post-metadata">

**Author:** ![ayush1920](https://onehack.st/user_avatar/onehack.st/ayush1920/32/38568_2.png) [@ayush1920](https://onehack.st/u/ayush1920)\
**Post date:** [November 9, 2020, 4:17am UTC](https://onehack.st/t/uploading-multiple-files-to-google-drive-through-google-colab/161730/5 "2020-11-09T04:17:29Z")

</div>

> [@ayush1920](#):
>
> !cp _._ drive/My\ Drive

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 -

> **[Wildcard | Linux#](https://geek-university.com/wildcard/)**
>
> This article describes what wildcards in Linux are and what are the most common ones.

---

<div class="post-metadata">

**Author:** ![Ardyey](https://onehack.st/user_avatar/onehack.st/ardyey/32/24218_2.png) [@Ardyey](https://onehack.st/u/Ardyey)\
**Post date:** [November 9, 2020, 4:25am UTC](https://onehack.st/t/uploading-multiple-files-to-google-drive-through-google-colab/161730/6 "2020-11-09T04:25:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Copy\_Paste](https://onehack.st/user_avatar/onehack.st/copy_paste/32/46275_2.png) [@Copy\_Paste](https://onehack.st/u/Copy_Paste)\
**Post date:** [November 9, 2020, 7:22am UTC](https://onehack.st/t/uploading-multiple-files-to-google-drive-through-google-colab/161730/7 "2020-11-09T07:22:26Z")

</div>

Can you give that Kochikame cartoon pls 😄

---

<div class="post-metadata">

**Author:** ![dillu\_dada](https://onehack.st/user_avatar/onehack.st/dillu_dada/32/26385_2.png) [@dillu\_dada](https://onehack.st/u/dillu_dada)\
**Post date:** [November 8, 2020, 1:50pm UTC](https://onehack.st/t/uploading-multiple-files-to-google-drive-through-google-colab/161730/3 "2020-11-08T13:50:25Z")

</div>

try using cyberduck

[Next page](https://onehack.st/t/uploading-multiple-files-to-google-drive-through-google-colab/161730.md?page=2)
