Giter Club home page Giter Club logo

autorclone's Introduction

AutoRclone: rclone copy/move/sync (automatically) with service accounts (still in the beta stage)

Many thanks for rclone and folderclone.

  • create service accounts using script
  • add massive service accounts into rclone config file
  • add massive service accounts into groups for your organization
  • automatically switch accounts when rclone copy/move/sync
  • Windows system supported

Step 1. Copy code to your VPS or local machine

Before everything, install python3. Because we use python as our programing language.

For Linux system: Install screen, git and latest rclone. If in Debian/Ubuntu, directly use this command

sudo apt-get install screen git && curl https://rclone.org/install.sh | sudo bash

After all requirements above are successfully installed, run this command

sudo git clone https://github.com/xyou365/AutoRclone && cd AutoRclone && sudo pip3 install -r requirements.txt

For Windows system: Directly download this project then install latest rclone. Then run this command (type in cmd command windows or PowerShell windows) in our project folder

pip3 install -r requirements.txt

Step 2. Generate service accounts

Let us create as many service accounts as possible.

Enable the Drive API in Python Quickstart and save it into project root path as credentials.json.

Run python3 gen_sa_accounts.py --quick-setup 5 --new-only to

  • create 6 projects (project 0 to project 5)
  • enable the required services
  • create 600 (6 projects, each with 100) Service Accounts
  • and download their credentials into a new folder accounts

After it is finished, there will be many json files in one folder named accounts.

Just copy all json files into our folder accounts.

What is service account

How to use service account in rclone.

Step 3. Add service accounts to Google Groups (Optional)

Support that you are GSuite admin (domain admin or normal admin)

Here we use Google Groups to manager our service accounts considering the
Official limits to the members of Team Drive (Limit for individuals and groups directly added as members: 600).

  1. Turn on the Directory API following official steps (save the generated json file to folder credentials).

  2. Create groups for your organization in the Admin console. After create a group, you will have an address for example[email protected].

  3. Run python3 add_to_google_group.py -p ./accounts -c credentials/*.json -g [email protected]

For meaning of above flags, please run python3 add_to_google_group.py -h

Step 4. Add service accounts or Google Groups into Team Drive

If you do not use Team Drive, just skip.

Add the group address [email protected] to your source Team Drive (tdsrc) and destination Team Drive (tddst).

If you are not Gsuite admin or do not care about the member limitation of Team Drive, just use script of folderclone to add sa accounts into Team Drive.

Enable the Drive API in Python Quickstart and save the credentials.json into project root path if you have not done it in Step 2.

  • Add service accounts into your source Team Drive: python3 add_to_team_drive.py -d SharedTeamDriveSrcID

  • Add service accounts into your destination Team Drive: python3 add_to_team_drive.py -d SharedTeamDriveDstID

Step 5. Start your task

Let us rclone copy hundreds of TB resource using service accounts.

  • For remote operation
  • publicly shared folder to Team Drive
  • Team Drive to Team Drive
  • publicly shared folder to publicly shared folder (with write privilege)
  • Team Drive to publicly shared folder
python3 rclone_sa_magic.py -s SourceID -d DestinationID -dp DestinationPathName -b 1 -e 400

Add --disable_list_r if rclone cannot read all contents of public shared folder.

For meaning of above flags, please run python3 rclone_sa_magic.py -h

  • For local to Google Drive (need test)
  • local to Team Drive
  • local to private folder
  • private folder to any (think service accounts cannot do anything about private folder)
python3 rclone_sa_magic.py -sp YourLocalPath -d DestinationID -dp DestinationPathName -b 1 -e 400
  • Run command tail -f log_rclone.txt to see what happens in details (linux only).

Let's talk about this project in Telegram Group AutoRclone

Blog(中文) | Google Drive Group | Google Drive Channel

autorclone's People

Contributors

mypierce avatar xyou365 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.