Skip to content

Streamline file uploads to Google Drive with ease. Experience real-time progress tracking while preserving file names.

License

Notifications You must be signed in to change notification settings

akhi07rx/File-Uploader-for-Google-Drive

Repository files navigation

image image image image image GitHub license image Safe

File Uploader for Google Drive

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.

Open In Colab

Features

  • 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.


Screenshots

image

image

image


Prerequisites

  • 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.

How to Use

  1. Open the Google Colab notebook.
  2. Run each cell in the notebook to execute the code.
  3. When prompted, enter the download link of the file you want to upload.
  4. The code will upload the file to a folder named "Downloads" in your Google Drive.
  5. The progress bar will display the real-time progress of the file upload.



  1. Mount Google Drive by running the following code in Google Colab:

from google.colab import drive

drive.mount('/content/drive')

  1. Run the script and provide the download link when prompted:

Enter the download link: [insert download link here]

  1. The script will create a folder named downloads in your Google Drive if it doesn't exist already.

  2. 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.


Customizing the Destination Folder

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/'

Code Components


  • 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.



Limitations


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.


Acknowledgments

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.

License


This project is licensed under the MIT License.

About

Streamline file uploads to Google Drive with ease. Experience real-time progress tracking while preserving file names.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published