mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-18 13:11:37 +00:00
Some checks failed
Build and test GAM / build (Win64, build, 7, VC-WIN64A, windows-2022) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 2, linux-aarch64, [self-hosted linux arm64]) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 4, linux-aarch64, [self-hosted linux arm64], yes) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 6, darwin64-arm64, macos-14) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 3, linux-x86_64, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 5, darwin64-x86_64, macos-13) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 8, ubuntu-24.04, 3.13) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 9, ubuntu-24.04, 3.9) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-apis (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
63 lines
3.1 KiB
Markdown
63 lines
3.1 KiB
Markdown
!# Users - Drive - Orphans
|
|
- [API documentation](#api-documentation)
|
|
- [Definitions](#definitions)
|
|
- [Collect orphaned files](#collect-orphaned-files)
|
|
|
|
## API documentation
|
|
* https://developers.google.com/drive/v3/reference/files
|
|
|
|
## Definitions
|
|
* [`<DriveFileEntity>`](Drive-File-Selection)
|
|
* [`<UserTypeEntity>`](Collections-of-Users)
|
|
|
|
```
|
|
<DomainName> ::= <String>(.<String>)+
|
|
<EmailAddress> ::= <String>@<DomainName>
|
|
<UniqueID> ::= id:<String>
|
|
<UserItem> ::= <EmailAddress>|<UniqueID>|<String>
|
|
|
|
<DriveFileName> ::= <String>
|
|
<DriveOrderByFieldName> ::=
|
|
createddate|createdtime|
|
|
folder|
|
|
modifiedbyme|modifiedbymedate|modifiedbymetime|modifiedbyuser|
|
|
modifieddate|modifiedtime|
|
|
name|
|
|
name_natural|
|
|
quotabytesused|quotaused|
|
|
recency|
|
|
sharedwithmedate|sharedwithmetime|
|
|
starred|
|
|
title|
|
|
title_natural|
|
|
viewedbymedate|viewedbymetime
|
|
```
|
|
## Collect orphaned files
|
|
Collect a users orphaned Drive files/folders into a target folder; only orphaned files not in the trash are processed.
|
|
```
|
|
gam <UserTypeEntity> collect orphans
|
|
[(targetuserfoldername <DriveFolderName>)|(targetuserfolderid <DriveFolderID>)]
|
|
[useshortcuts [<Boolean>]]
|
|
(orderby <DriveOrderByFieldName> [ascending|descending])*
|
|
[preview [todrive <ToDriveAttribute>*]]
|
|
```
|
|
* `targetuserfoldername <DriveFileName>` - This is the parent folder name for the orphaned files; the default is "#user# orphaned files". In this string, #user# and #email# will be replaced by the source user email address, #username# will be replaced by the source user mail address without the domain. This folder will be created is necessary.
|
|
* `targetuserfolderid <DriveFolderID>` - This is the parent folder ID for the orphaned files; it must exist.
|
|
* `useshortcuts false` - Add the target user folder as the parent of an orphan if it can be done; otherwise, put a shortcut to the orphan into the target user folder. This is the default behavior. Changing the parent may affect the orphan's access by other users.
|
|
* `useshortcuts` or `useshortcuts true` - Put a shortcut to the orphan into the target user folder and do not modify the orphan's parents. GAM will not duplicate an existing shortcut.
|
|
* `orderby <DriveOrderByFieldName> [ascending|descending])*` - Specify the order in which files are processed.
|
|
* `preview` - If `preview` is specified, no files are collected; a CSV file listing the files to be collected is output.
|
|
* `todrive <ToDriveAttribute>*` - When `preview` is specified, the CSV file can be uploaded to Google
|
|
|
|
### Example
|
|
Collect a users orphaned files into the folder "Orphans - testuser@domain.com" on their `My Drive`; change orphan parents if possible without affecting access by other users;
|
|
otherwise, use a shortcut.
|
|
```
|
|
gam user testuser@domain.com collect orphans targetuserfoldername "Orphans - #user#"
|
|
```
|
|
|
|
Collect a users orphaned files into the folder "Orphans - testuser@domain.com" on their `My Drive`; use shortcuts for all orphans rather than changing any orphan's parents.
|
|
```
|
|
gam user testuser@domain.com collect orphans targetuserfoldername "Orphans - #user#" useshortcuts
|
|
```
|