This repository contains a Google Colab notebook that allows you to upload files from a given download link to your Google Drive with real-time progress tracking. The code is written in Python and utilizes the requests
library for file download and the tqdm
library for progress tracking.
-
Upload files to Google Drive from a download link.
-
Real-time progress tracking using a progress bar.
-
Preserve the original file name during the upload process.
-
Automatically create a destination folder if it doesn't already exist.
-
Ability to insert multiple download links: The code now allows the user to enter multiple download links one after the other until they choose to exit the program by typing "exit".
-
Saving the downloaded file to the specified destination folder in your Google Drive.
-
Displaying information about the downloaded file such as its name, size, and saved location.
-
Option to exit the program: The user can type "exit" to quit the program instead of providing a download link.
- Google Colab: This code is designed to be run in a Google Colab notebook. If you don't have one, you can create a new notebook on the Google Colab platform.
- Open the Google Colab notebook.
- Run each cell in the notebook to execute the code.
- When prompted, enter the download link of the file you want to upload.
- The code will upload the file to a folder named "Downloads" in your Google Drive.
- The progress bar will display the real-time progress of the file upload.
- Mount Google Drive by running the following code in Google Colab:
from google.colab import drive
drive.mount('/content/drive')
- Run the script and provide the download link when prompted:
Enter the download link: [insert download link here]
-
The script will create a folder named downloads in your Google Drive if it doesn't exist already.
-
The file will be downloaded from the provided URL and saved to the downloads folder.
Please note that the progress of the download will be displayed using a progress bar provided by the tqdm library.
Once the download is complete, the script will print a success message indicating the name of the downloaded file and the destination folder.
Make sure to replace ' [insert download link here] ' with the actual URL from which you want to download the file.
Feel free to modify the destination folder according to your preference by changing the 'destination_folder' variable.
By default, the code uploads files to the "downloads" folder in your Google Drive. If you want to upload the files to a different folder, you can modify the destination_folder
variable in the code to specify the desired folder path.
destination_folder = '/content/drive/MyDrive/your-folder/'
-
Mounting Google Drive: This step allows the notebook to access your Google Drive and perform file operations.
-
Parsing the Download Link: The download link provided by the user is parsed using the urlparse function to extract the file name. This ensures that the file is saved with its original name.
-
Downloading the File: The code uses the requests library to download the file from the provided link. The file is downloaded in chunks to enable real-time progress tracking.
-
Uploading the File to Google Drive: The downloaded file is then saved to the specified destination folder in Google Drive. The open function is used to create the file in write binary mode, and the file is written in chunks to ensure efficient upload.
-
Progress Tracking: The tqdm library is used to create a progress bar that updates in real time as the file is being uploaded. The progress bar displays the current progress and the total file size.
This code is designed for uploading files to Google Drive from a download link. It may not be suitable for other file upload scenarios. The upload speed is dependent on your internet connection and the server's capacity from which you are downloading the file.
This code was developed with help from various online resources, including documentation for Python libraries such as requests
and tqdm
. We would like to thank all contributors who have shared their knowledge and expertise with us.
This project is licensed under the MIT License.