Download files directly to Google Drive (using Google Colaboratory)

Background / Usage

Even when your line is weak due to the use of a mobile router, such as trained models and videos of machine learning with a large file size, and a large number of image files, you can download without using your own line. It seems that google originally prepared an extension, but I decided to write it because it will be abolished.

From the conclusion. Sample code

from google.colab import drive 
drive.mount('/content/drive')
!wget -P "/content/drive/My Drive/download" https://xxxxx.xxx

Google Colaboratory is extremely convenient. Thank you, google.

Commentary

This is a method to download files on the web directly to Google Drive using Colaboratory.

There are 3 lines, but please write the upper 2 lines and the lower line separately. Let them be the first cell and the second cell, respectively. image.png

Mount it on drive in cell 1. When you run it, you will be prompted for it. image.png

You can log in to your Google account by clicking the output link. Please copy and paste the token to the part that accepts input. Google Drive will be mounted.

Specify the output destination with wget -P in the second cell. At "/ content / drive / My Drive /", the root of My Drive. download is the name of any folder you created on the drive.

It is OK if you execute the second cell.

How to use Colaboratory

There are many others, so I would appreciate it if you could refer to them, but I would like to briefly describe them. -Create a new notebook from the Colaboratory initial screen. image.png image.png ・ Copy the above two lines and press the triangle mark (execution mark) on the left side of the cell. ·Authenticate

・ Use + to create a new cell. -Copy the third line and rewrite the URL and save destination. -Press the triangle mark (execution mark) on the left side of the cell.

that's all.

Recommended Posts

Download files directly to Google Drive (using Google Colaboratory)
Download data directly from Drive URL (Google Colaboratory)
How to load files in Google Drive with Google Colaboratory
Download Google Drive files in Python
Regularly upload files to Google Drive using the Google Drive API in Python
Upload files to Google Drive with Lambda (Python)
How to analyze with Google Colaboratory using Kaggle API
How to use Google Colaboratory
Try to implement linear regression using Pytorch with Google Colaboratory
How to display formulas in latex when using sympy (> = 1.4) in Google Colaboratory
[Beginner] Python web scraping using Google Colaboratory
Google colaboratory
Usual processing notes when using Google Colaboratory
First-principles calculations for free using Google Colaboratory
Using Java's Jupyter Kernel with Google Colaboratory
How to download youtube videos using pytube3
Download files in any format using Python
Use boto to upload / download files to s3.
Upload images to Google Drive with Python
Try to download Youtube videos using Pytube
I tried to synthesize WAV files using Pydub.
I want to visualize csv files using Vega-Lite!
Download the VGG Face2 dataset directly to the server
Download the csv file created by Google Colaboratory
How to upload to a shared drive using pydrive
I want to collect a lot of images, so I tried using "google image download"
[Python] Save PDF from Google Colaboratory to Google Drive! -Let's collect data for machine learning-
Upload JPG file using Google Drive API in Python
Google Drive API Set File Permission (Set permissions on Google Drive files)
Easy way to scrape with python using Google Colab
Copy files directly from Amazon EC2 (Amazon linux) to S3
How to download files from Selenium in Python in Chrome
Copy S3 files from Python to GCS using GSUtil
Upload to a shared drive with Google Drive API V3
Let's easily make a math gif using Google Colaboratory
How to use Spacy Japanese model in Google Colaboratory
I tried to access Google Spread Sheets using Python
Building an environment to use CaboCha with google colaboratory
Until we created a mechanism to upload files shared in Slack to Google Drive without a server
How to easily draw the structure of a neural network on Google Colaboratory using "convnet-drawer"