GDM will help you to migrate your Google Drive documents from one domain to another domain
- Not use "'me' in owners" query when searching for children files of shared folders
-
Get user's own files by query:
"'me' in owners"
-
Add "'me' in owners" to query when searching files
-
Simplify functions's name
-
share_files function returns permission id list and shared files list
-
Pass shared files list to make_a_copy instead of all files.
-
Get files in which the processing user is the owners with query:
"'[email protected]' in owners and trashed = false"
-
Do not start renaming files process if length of the unique file names is equal the number of files, which mean there is no duplicate file:
len(filename_list) < len(files)
-
Get parents of a file by fileId
- Test with 876 users and finish migrating in > 2 days
- Catch httplib.BadStatusLine exception on all query functionalities (insert, update, delete...)
- Still return the file['id'] if the file existed and newer when copying (for copy permissions)
- encode('utf8') when printing out info to console
- Tested with multiple accounts:
- Got error 500 when copying file error.csv. OK after re-running the script.
- Got error "httplib.BadStatusLine: ''" when copying permissions. Fixed by catch BadStatusLine exception in "search_files".
- Copy unique files and folders (including children files and folders)
- skip copying newer existed files / folders
- Copy permissions with additionalRoles (commenter)
- More console output for debugging
- Rename duplicate files/folders of all users by modified date
- Delete file by id
- Copy unique file
- Processing gdm with condition parameters
- Get accounts which have duplicate files/folders
- Copy permissions
- Copy all permissions of all files
- Create drive service with service account
- Share files and folders
- Disable sharing
- Migrate files and folders
- authorize app
- insert file
- retreive files and folders
- retreive permissions
- insert permission
- remove permission
- get permission id from email
- copy file
- create a folder
- google-api-python-client==1.2
- httplib2==0.8
- pyOpenSSL==0.13.1
- python-dateutil==2.2
username@user-host:/path/to/gdm$ virtualenv /home/.venv/your_env
username@user-host:/path/to/gdm$ source /home/.venv/your_env/bin/activate
(your_env)username@user-host:/path/to/gdm$ pip install -r requirements.txt
(your_env)username@user-host:/path/to/gdm$ python gdm.py /path/to/email_mapping_list.csv
- email_mapping_list.csv (2 columns: src - old domain email address, dest - new domain email address):
src | dest |
---|---|
[email protected] | [email protected] |
[email protected] | [email protected] |
[email protected] | [email protected] |
- condition number: all posible numbers are:
0,1,2,3,4,5,6,7,8,9 or 'all'
- Cannot use SignedJwtAssertionCredentials?
- Error When installing PyOpenSSL:
- The official guide for setting up Google Drive Domain-wide Service Account didn't work?
- _csv.Error: Could not determine delimiter
- I used only one Service Account because I migrated users's documents from sub.mydomain.com to mydomain.com. So, you need to create 2 Service Accounts, one for your old domain, one for your new domain. Then, you have to modify the gdm.py file to use the correct Service Account for each domain.
- https://developers.google.com/drive/quickstart-python
- https://developers.google.com/drive/v2/reference/
Found bugs or have questions?:
- Email: dangtrinhnt[at]gmail[dot]com - Trinh Nguyen
- Twitter: @dangtrinhnt