taeram / google-drive-bulk-copy

Recursively copy an entire folder tree in Google Drive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Drive Bulk Copy

Bulk copy an entire Google Drive folder to another location in your Google Drive.

Features

This script will recursively copy a source folder into a destination folder.

  • Files are skipped if they match a certain pattern (see config/config.yml for the ignore list)
  • Files are only copied to the destination once, meaning you can delete them from the destination and then re-run this script without re-copying the file.

Setup

Google Developer Console

  1. Browse to the Google Developers Console
  2. Create a new project called "Google Drive Bulk Copy".
  3. On the Dashboard, click "Library" in the sidebar
  4. In the search box, type "Drive" and click "Google Drive API"
  5. Click "Enable"
  6. In the sidebar, click "Credentials".
  7. Click "Create Credentials", and select "OAuth Client ID".
  8. Under "Create Client ID", select "Other".
  9. For "Name", type "CLI".
  10. Close the dialog that pops up with the Client ID and secret. We'll download those in the next step.
  11. Find your Client in the list of Client ID's, and click the Download button next to it.
  12. Copy the client_secret_1234-abcd.json file that you download to config/client_secret.json.

PHP

  1. You'll need at least PHP 5.4 with the php-sqlite package installed
  2. Lastly, you'll need to install the Composer dependencies: composer install

Operation

  1. Find the full URL to your Source and Destination folders in Google Drive:
  2. Start the copy with:
    • php copy.php https://source-folder-url http://destination-folder-url

About

Recursively copy an entire folder tree in Google Drive

License:MIT License


Languages

Language:PHP 96.3%Language:JavaScript 3.7%