Transfer the ownership between two different domains by coping folder hierarchy and files.
This tool is EXPERIMENTAL and is NOT an official tool. This tool is released WITHOUT ANY warranty of any kind.
Source | Dest |
---|---|
Google Workspace | Google Account (gmail) |
Google Account (gmail) | Google Workspace |
Google Workspace A | Google Workspace B |
node +16
Follow Develop on Google Workspace guide to set up an OAuth consent screen and OAuth Credentials
https://developers.google.com/workspace/guides/get-started?hl=en_US
-
Create a Google Cloud project
-
Enable Drive API
-
Configure OAuth consent screen
-
Create OAuth credentials
-
Create an .env file from .env_template (
cp .env_template .env
) and set up env vars. -
Build the project
yarn && yarn build
Trash should be empty
- Share (with role Editor) files and folders to be transferred with the destination account.
- Create 'migrationSource' folder in the destination Drive account.
- Put inside all files and folders to be migrated
- Run the script
./bin/google-drive-migration-tool migrate
First time the script opens the browser to request the permissions to read and write files in Drive. Credentials are stored in a file named token.json. If you want to change the user you need to delete this file.
Copied files are located at 'migrationDest' folder in the root (MyDrive)
Google Auth reference: https://github.com/googleapis/google-auth-library-nodejs#oauth2 https://cloud.google.com/nodejs/docs/reference/google-auth-library/latest
Inspired on https://www.npmjs.com/package/@google-cloud/local-auth to retrieve the auth token. https://developers.google.com/drive/api/quickstart/nodejs?hl=en_US#authorize_credentials_for_a_desktop_application
Google Drive
Based on https://developers.google.com/drive/api/quickstart/nodejs?hl=en_US Api reference: https://developers.google.com/drive/api/v3/reference