-
Notifications
You must be signed in to change notification settings - Fork 88
Users Drive Transfer
- https://developers.google.com/drive/api/v3/reference/files
- https://developers.google.com/drive/api/v3/ref-single-parent
- https://support.google.com/a/answer/1247799
<DomainName> ::= <String>(.<String>)+
<EmailAddress> ::= <String>@<DomainName>
<UniqueID> ::= id:<String>
<UserItem> ::= <EmailAddress>|<UniqueID>|<String>
<DriveFileOrderByFieldName> ::=
createddate|createdtime|
folder|
lastviewedbyme|lastviewedbymedate|lastviewedbymetime|lastviewedbyuser|
modifiedbyme|modifiedbymedate|modifiedbymetime|modifiedbyuser|
modifieddate|modifiedtime|
name|
name_natural|
quotabytesused|quotaused|
recency|
sharedwithmedate|sharedwithmetime|
starred|
title|
title_natural|
viewedbymedate|viewedbymetime
gam <UserTypeEntity> transfer drive <UserItem> [select <DriveFileEntity>]
[(targetfolderid <DriveFolderID>)|(targetfoldername <DriveFolderName>)]
[targetuserfoldername <DriveFolderName>] [targetuserorphansfoldername <DriveFolderName>]
[mergewithtarget [<Boolean>]]
[skipids <DriveFileEntity>]
[keepuser|(retainrole reader|commenter|writer|editor|contentmanager|fileorganizer|none)]
[noretentionmessages]
[nonowner_retainrole reader|commenter|writer|editor|contentmanager|fileorganizer|current|none]
[nonowner_targetrole reader|commenter|writer|editor|contentmanager|fileorganizer|current|none|source]
(orderby <DriveFileOrderByFieldName> [ascending|descending])*
[preview] [todrive <ToDriveAttribute>*]
By default, all of the source users files will be transferred except those in the trash. If you want to transfer a subset of
the source users files, use the select <DriveFileEntity>
option.
This option handles special cases where you want to prevent selected files/folders from being transferred.
-
skipids <DriveFileEntity>
- Do not transfer files/folders with the specified IDs.
You can specify the access that the source user retains to the files that it owns. If no option is specified, the source user retains no access to the transferred files.
-
keepuser
- The source user retains write access to the files; old style, equivalent toretainrole writer
. -
retainrole reader|commenter|writer|editor|contentmanager|fileorganizer
- The source user retains the specified access to the files. -
retainrole none
- The source user retains no access to the files; this is the default.
You can specify the access that the source user retains to the files that it does not own.
If no option is specified, the source user retains the same access as specifed with retainrole
.
-
nonowner_retainrole reader|commenter|writer|editor|contentmanager|fileorganizer
- The source user retains the specified access to the files. -
nonowner_retainrole current
- The source user retains its current access to the files. -
nonowner_retainrole none
- The source user retains no access to the files.
You can specify the access that is assigned to the target user for those files that the source user does not own. If the target user already has access to a file, the following options will not diminish that access. If no option is specified, the target user gets the same access to the files that the source user had.
-
nonowner_targetrole reader|commenter|writer|editor|contentmanager|fileorganizer
- The target user gets the specified access to the files. -
nonowner_targetrole current
- The target user maintains its current access to the files. -
nonowner_targetrole none
- The target user gets no access to the files. -
nonowner_targetrole source
- The target user gets the same access to the files that the source user had; this is the default. -
noretentionmessages
- Suppress the role retention messages.
The transferred files are placed into a subfolder of an existing parent folder that belongs to the target user. The parent folder must exist, the subfolder will be created if necessary.
Choose one of the following options to specify an existing target user folder as the parent folder of the subfolder. If neither option is chosen, the root folder of the target user will be the parent folder of the subfolder.
-
targetfolderid <DriveFolderID>
- The ID of an existing folder owned by the target user, -
targetfoldername <DriveFolderName>
- The name of an existing folder owned by the target user.
Use the following option to specify the subfolder of the parent folder to receive the transferred files.
This folder will be created if necessary. If targetuserfoldername
is not specified, the default value #user# old files
will be used.
-
targetuserfoldername <DriveFolderName>
- The name of a subfolder under the parent folder. -
targetuserfoldername ""
- No subfolder will be created, the transferred files will be transferred to the parent folder.
The option mergewithtarget
, when used with select <DriveFileItem>
, transfers a folder without creating a new folder in the target user folder.
The contents of the folder, but not the folder itself, are transferred to the new owner.
Use the following option to specify the subfolder of the parent folder to receive the transferred orphaned files.
This folder will be created if necessary. If targetuserorphansfoldername
is not specified, the default value #user# orphaned files
will be used.
-
targetuserorphansfoldername <DriveFolderName>
- The name of a subfolder under the parent folder. -
targetuserorphansfoldername ""
- No subfolder will be created, the transferred orphaned files will be transferred to the parent folder.
In <DriveFolderName>
, the following substitutions will be made:
-
#user#
- Will be replaced by the source users email address. -
#email#
- Will be replaced by the source users email address. -
#username#
- Will be replaced by the portion of the source users email address before the @.
Use the preview
option to output a CSV file showing the files to be transferred without actually performing the transfer.
The column headers are: OldOwner, NewOwner, type, id, title
.
As of September 30th, 2020, Google changed how Drive API behaves where multi-parenting of a file is no longer allowed. When moving a file which has inherited permissions, it's important to review permissions before attempting an ownership transfer.
When transferring ownership of a file, the requester can control whether the transferred file is moved to the new owner’s My Drive or kept in its current location. If the requester chooses to move the file, any access inherited from the previous parent is lost. However, the access that had been directly added to the file is preserved. The previous owner maintains editor access on the file, just as they had prior to these changes.
Use defaults for the parent folder and subfolder; a subfolder named [email protected] old files
will be created as a subfolder of the root folder of [email protected].
The source user retains no access to the files.
gam user [email protected] transfer drive [email protected]
Transfer several users files to subfolders named "#username#'s Files" under the existing target parent folder named "Transferred Files".
gam users olduser1,olduser2,olduser3 transfer drive [email protected] targetfoldername "Transferred Files" targetuserfoldername "#username#'s Files" targetuserorphansfoldername" "#username#'s Orphaned Files"
Need more help? Ask on the GAM Discussion Group
Update History
Installation
- How to Install GAM7
- How to Uograde GAMADV-XTD3 to GAM7
- How to Upgrade Legacy GAM to GAM7
- How to Update GAM7
- Install GAM as Python Library
- GAM7 on Chrome OS Devices
- GAM7 on Android Devices
- Google Network Addresses
- HTTPS Proxy
- SSL Root CA Certificates
- How to Uninstall GAM7
Configuration
- Authorization
- GAM Configuration
- Running GAM7 securely on a Google Compute Engine
- Using GAM7 with a delegated admin service account
- Using GAM7 with a YubiKey
Notes and Information
- Upgrade Benefits
- Questions? Visit the GAM Discussion Forum
- GAM Public Chat Room
- Scripts
- Other Resources
- Drive REST API v3
- BNF Syntax
- GAM Return Codes
- Python Regular Expressions
- Rclone
Definitions
Command Processing
- Bulk Processing
- Command Line Parsing
- Command Logging and Progress
- Command data from Google Docs/Sheets/Storage
- CSV Special Characters
- CSV Input Filtering
- CSV Output Filtering
- Meta Commands and File Redirection
- Permission matches
- Tag Replace
- Todrive
Collections
Client Access
- Addresses
- Administrators
- Alert Center
- Aliases
- Calendars
- Calendars - Access
- Calendars - Events
- Chrome Auto Update Expiration Counts
- Chrome Browser Cloud Management
- Chrome Device Needs Attention Counts
- Chrome Installed Apps
- Chrome Policies
- Chrome Printers
- Chrome Profile Management
- Chrome Version Counts
- Chrome Version History
- ChromeOS Devices
- Classroom - Courses
- Classroom - Guardians
- Classroom - Invitations
- Classroom - Membership
- Cloud Channel
- Cloud Identity Devices
- Cloud Identity Groups
- Cloud Identity Groups - Membership
- Cloud Identity Policies
- Cloud Storage
- Context Aware Access Levels
- Customer
- Domains
- Domains - Verification
- Domain People - Contacts & Profiles
- Domain Shared Contacts - Global Address List
- Email Audit Monitor
- Find File Owner
- Google Data Transfers
- Groups
- Groups - Membership
- Inbound SSO
- Licenses
- Mobile Devices
- Organizational Units
- Reports
- Reseller
- Resources
- Send Email
- Schemas
- Shared Drives
- Sites
- Users
- Unmanaged Accounts
- Users - Signout and Turn off 2-Step Verification
- Vault - Takeout
- Version and Help
Special Service Account Access
Service Account Access
- Users - Analytics Admin
- Users - Application Specific Passwords
- Users - Backup Verification Codes
- Users - Calendars
- Users - Calendars - Access
- Users - Calendars - Events
- Users - Chat
- Users - Classification Labels
- Users - Classroom - Profile
- Users - Deprovision
- Users - Contacts
- Users - Contacts - Delegates
- Users - Drive - File Selection
- Users - Drive - Activity/Settings
- Users - Drive - Cleanup
- Users - Drive - Comments
- Users - Drive - Copy/Move
- Users - Drive - Files-Display
- Users - Drive - Files-Manage
- Users - Drive - Orphans
- Users - Drive - Ownership
- Users - Drive - Permissions
- Users - Drive - Query
- Users - Drive - Revisions
- Users - Drive - Shortcuts
- Users - Drive - Transfer
- Users - Forms
- Users - Gmail - Client Side Encryption
- Users - Gmail - Delegates
- Users - Gmail - Filters
- Users - Gmail - Forwarding
- Users - Gmail - Labels
- Users - Gmail - Messages/Threads
- Users - Gmail - Profile
- Users - Gmail - S/MIME
- Users - Gmail - SendAs/Signature/Vacation
- Users - Gmail - Settings
- Users - Group Membership
- Users - Keep
- Users - Looker Studio
- Users - Meet
- Users - Classroom - Profile
- Users - People - Contacts & Profiles
- Users - Photo
- Users - Profile Sharing
- Users - Shared Drives
- Users - Spreadsheets
- Users - Tasks
- Users - Tokens
- Users - YouTube