Skip to main content

Clone folders in Google Drive

Project description

CircleCI

Google Drove Folder Cloner

Contents

  1. Description
  2. Install
  3. Usage
  4. Contributing

Description

A python package for cloning google drive folders, including all subdirectories and files

Installation

To install from pypi

pip install googledrive-googledrive_cloner

To install locally

git clone https://github.com/NickHilton/googledrivecloner.git

Google Drive Set up

In order for this package to work, any GDrive account you use must be set up with the correct permissions. More detail is given in Google's documentation

The following steps should get you set up correctly

  1. Create a Google Project - here
  2. Enable the Google Drive API on your project - here
  3. Create a service account for authorization as described in the documentation
  4. Save the client-secret created during the previous step to your environment and set the environment variable CLIENT_SECRET_PATH to point to the file
  5. Enable sharing for the folder you wish to copy, and share the folder with the email from the created service account

Usage

To clone a directory you need to get both the gdrive id of the folder to be copied and the destination folder. You can discover these ids by looking at the url

https://drive.google.com/drive/u/0/folders/{FOLDER_ID}

The cloner can be used in the following way:

from googledrive_cloner.google_connections import GoogleDriveCloner
googledrivecloner = GoogleDriveCloner()
folder_id_to_copy = 'XXXXXXXX'
destination_folder_id = 'YYYYYYYYY'
new_folder_name = 'lemons'  # Or something else!

googledrivecloner.run(
    base_folder_id=folder_id_to_copy, 
    destination_parent_folder_id=destination_folder_id, 
    new_name=new_folder_name
)

Contributing

All contributions are welcome, feel free to ask a question or propose a change via a Pull Request

Running Tests

In the root/src directory

python -m unittest discover

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

googledrive_cloner-1.0.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

googledrive_cloner-1.0.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file googledrive_cloner-1.0.0.tar.gz.

File metadata

  • Download URL: googledrive_cloner-1.0.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.8

File hashes

Hashes for googledrive_cloner-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fe4803e1a94b242894f0d44eefc27bca9505e939f2caa0716a3d6e3768ba422d
MD5 707c2453fcc548fac49259c44fc96c7a
BLAKE2b-256 540903d7fafc5339a2ca749eea108e140539de5442556e4b236edcb891152437

See more details on using hashes here.

File details

Details for the file googledrive_cloner-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: googledrive_cloner-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.8

File hashes

Hashes for googledrive_cloner-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a811704f592b9da82f8f46dfc55e0b3e8959398521d04fca54d935c0750cd84c
MD5 f7d0c054cf07ebe9fd54c77e6bd9e37d
BLAKE2b-256 a40680c2df6e17c1d4489905b47fbd75ec6221448335c94c39ba2ce1d558135e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page