Google Drive CLI
for cmdhub.
Files, folders, metadata, trash, and sharing permissions from the terminal.
cmdhub get gdrive
data_object Agent Contract
Agents should start with auth/status and discovery commands, inspect schemas before composition, and treat commands marked as mutating as state-changing operations.
Output
Use human output for normal reads, `--json` for scripting or complete structured fields, and `--jsonl` for upstream pipe inputs.
Auth
Google OAuth. Used for Drive files, folders, metadata, trash, and permissions.
Refs
Prefer list/search, then short refs or piped JSONL. Use `resolve` to inspect cached refs.
Schemas
Use `gdrive schema` and `catalog.json` to inspect fields, flags, examples, and side effects.
Auth scopes
openidemailhttps://www.googleapis.com/auth/driveterminal Command Reference
Generated from source. Global flags apply to all commands.
Global Flags
--json
bool
Emit JSON machine output--jsonl
bool
Emit JSONL records for piping--output, -o
string
Compatibility output mode: json|jsonl. Prefer --json or --jsonl--view
string = summary
View mode: summary|full--profile
string = default
Config/auth profile--config
string
Config path override--quiet, -q
bool
Suppress non-essential diagnostics--debug
bool
Enable debug diagnostics--limit
int = 50
Maximum items to emit--page-size
int = 50
Requested upstream page size--cursor
string
Continuation cursor--no-paginate
bool
Fetch only one page--version, -v
bool
Print version informationgdrive auth
Manage Google Drive authenticationgdrive auth login
Authenticate with Google Drive--delegate
string
Delegated Google Workspace user email for domain-wide delegation--key-file
string
Path to a Google service-account JSON key file--service-account
bool
Use a Google Workspace delegated service-account JSON key credentialgdrive auth logout
Remove stored credentialsgdrive auth refresh
Refresh stored tokengdrive auth status
Show auth statusgdrive auth whoami
Show current Drive identitygdrive capabilities
Describe capabilities--section
string
Show one capability section: scopes, schemas, or commandsgdrive change
Inspect Drive change tokens and changesgdrive change list
List Drive changes from a page token--page-token
string
Drive changes page tokengdrive change start-token
Get a Drive changes start page tokengdrive comment
Manage Drive commentsgdrive comment create
Create a comment--body
string
Comment body--content
string
Alias for --body--file
string
File selector--notify
bool
Send Google Drive comment notifications--yes
bool
Confirm creating without sending notificationsgdrive comment delete
Delete a comment--comment
string
Comment selector--dry-run
bool
Preview comment deletion without deleting--file
string
File selector--yes
bool
Confirm comment deletiongdrive comment get
Get a comment--comment
string
Comment selector--file
string
File selectorgdrive comment update
Update a comment--body
string
Updated comment body--comment
string
Comment selector--content
string
Alias for --body--file
string
File selector--notify
bool
Send Google Drive comment notifications--yes
bool
Confirm updating without sending notificationsgdrive config
Inspect local configurationgdrive config explain
Explain resolved configurationgdrive doctor
Run gdrive diagnosticsgdrive file
Manage Drive filesgdrive file copy
Copy a Drive file--description
string
Copied file description--file
string
File selector--folder
string
Destination folder selector--name
string
Copied file namegdrive file create
Create a metadata-only Drive file--description
string
File description--folder
string
Parent folder selector--mime-type
string
Drive MIME type--name
string
Drive file namegdrive file delete
Permanently delete a file--all
bool
Confirm batch permanent deletion--dry-run
bool
Preview permanent deletion without deleting--file
string
File selector--yes
bool
Confirm permanent deletiongdrive file download
Download file bytes--acknowledge-abuse
bool
Confirm you understand Google flagged this file as abusive or malware and still want to download it--file
string
File selector--out
string
Output path--stdout
bool
Write bytes to stdout explicitlygdrive file export
Export a Google Docs file--file
string
File selector--format
string
Friendly export format: pdf, docx, xlsx, pptx, txt, or csv--mime-type
string = text/plain
Export MIME type--out
string
Output path--stdout
bool
Write bytes to stdout explicitlygdrive file get
Get file metadata--file
string
File selectorgdrive file list
List files--corpus
string
Drive corpus: user|domain|drive|allDrives--created-after
string
Filter by createdTime after RFC3339 timestamp--created-before
string
Filter by createdTime before RFC3339 timestamp--folder
string
Folder selector--mime-type
string
Filter by exact Drive MIME type--modified-after
string
Filter by modifiedTime after RFC3339 timestamp--modified-before
string
Filter by modifiedTime before RFC3339 timestamp--not-shared
bool
Filter to files that are not shared--owned-by-me
bool
Filter to files owned by the current user--owner
string
Filter by owner email or permission ID--parent
string
Alias for --folder--query
string
Name/full-text query--shared
bool
Filter to shared files--shared-drive
string
Shared drive selector--shared-with-me
bool
Filter to files shared with the current user--starred
bool
Filter to starred files--trashed
bool
Include trashed files--type
string
Filter by type alias: file|folder|doc|sheet|slide|drawing|pdf|image|video|audio|shortcutgdrive file move
Move a file to another folder--file
string
File selector--from
string
Source folder selector to remove--replace-parents
bool
Remove all current parents before adding --to--to
string
Destination folder selector--yes
bool
Confirm parent replacementgdrive file search
Search files by name or text--corpus
string
Drive corpus: user|domain|drive|allDrives--created-after
string
Filter by createdTime after RFC3339 timestamp--created-before
string
Filter by createdTime before RFC3339 timestamp--folder
string
Folder selector--mime-type
string
Filter by exact Drive MIME type--modified-after
string
Filter by modifiedTime after RFC3339 timestamp--modified-before
string
Filter by modifiedTime before RFC3339 timestamp--not-shared
bool
Filter to files that are not shared--owned-by-me
bool
Filter to files owned by the current user--owner
string
Filter by owner email or permission ID--parent
string
Alias for --folder--query
string
Name/full-text query--shared
bool
Filter to shared files--shared-drive
string
Shared drive selector--shared-with-me
bool
Filter to files shared with the current user--starred
bool
Filter to starred files--trashed
bool
Include trashed files--type
string
Filter by type alias: file|folder|doc|sheet|slide|drawing|pdf|image|video|audio|shortcutgdrive file star
Star a file--file
string
File selectorgdrive file trash
Move a file to trash--all
bool
Confirm batch trash--file
string
File selectorgdrive file unstar
Unstar a file--file
string
File selectorgdrive file untrash
Restore a file from trash--all
bool
Confirm batch untrash--file
string
File selectorgdrive file update
Update file metadata or parents--add-parent
stringSlice = []
Folder selector to add as parent--description
string
New description--file
string
File selector--name
string
New file name--remove-parent
stringSlice = []
Folder selector to remove as parent--starred
bool
Set starredgdrive file upload
Upload a local file--description
string
File description--folder
string
Parent folder selector--mime-type
string
Content MIME type--name
string
Drive file name--path
string
Local file path--resumable
bool
Use a resumable Drive upload sessiongdrive folder
Manage Drive foldersgdrive folder create
Create a folder--description
string
Folder description--name
string
Folder name--parent
string
Parent folder selectorgdrive folder delete
Permanently delete a folder--dry-run
bool
Preview permanent deletion without deleting--folder
string
Folder selector--yes
bool
Confirm permanent deletiongdrive folder get
Get folder metadatagdrive folder list
Look up folders by name, parent, or shared drive--parent
string
Parent folder selector--query
string
Folder name query--shared-drive
string
Shared drive selector--trashed
bool
Include trashed foldersgdrive folder move
Move a folder to another folder--folder
string
Folder selector--from
string
Source folder selector to remove--replace-parents
bool
Remove all current parents before adding --to--to
string
Destination folder selector--yes
bool
Confirm parent replacementgdrive folder search
Search folders by name or token--parent
string
Parent folder selector--query
string
Folder name query--shared-drive
string
Shared drive selector--trashed
bool
Include trashed foldersgdrive folder trash
Move a folder to trash--folder
string
Folder selectorgdrive folder untrash
Restore a folder from trash--folder
string
Folder selectorgdrive folder update
Update folder metadata--description
string
New folder description--folder
string
Folder selector--name
string
New folder namegdrive mcp
Run the MCP serverRun a stdio Model Context Protocol server for this adapter.
The server exposes read-only resource commands by default. Mutating commands are listed only when explicitly allowed with –allow and remain gated by the command contract safety class.
--allow
stringArray = []
Allow mutating command keys such as gmail.message.archive or gmail.message.label.*--allow-dangerous
bool
Allow --allow wildcards to include destructive or sends_external commands--concurrency
int
Maximum concurrent MCP subprocesses--max-output
int64 = 0
Maximum stdout/stderr bytes captured per MCP command--print-config
bool
Print MCP tool configuration and exit--timeout
duration = 0s
Per-command MCP subprocess timeout, for example 45s or 2mgdrive permission
Manage Drive permissionsgdrive permission add
Add a permission--allow-discovery
bool
Allow public/domain discovery--domain
string
Domain for domain permission--email
string
Email address for user/group permission--file
string
File selector--message
string
Optional notification email message--notify
bool
Send Google Drive notification email--role
string = reader
Permission role: reader|commenter|writer--type
string
Permission type: user|group|domain|anyone (required)--yes
bool
Confirm broad/public permission creation or notification sendsgdrive permission get
Get a file permission--file
string
File selector--permission
string
Permission selectorgdrive permission list
List file permissions--file
string
File selectorgdrive permission remove
Remove a permission--all
bool
Confirm batch permission removal--dry-run
bool
Preview permission removal without changing permissions--file
string
File selector--permission
string
Permission selector--yes
bool
Confirm permission removalgdrive permission update
Update a permission--allow-discovery
bool
Allow public/domain discovery--expiration
string
RFC3339 expiration time, or empty to clear--file
string
File selector--permission
string
Permission selector--role
string
Permission role: reader|commenter|writer--yes
bool
Confirm broad/public permission updategdrive profile
Manage provider profilesgdrive profile create
Create an unauthenticated provider profilegdrive profile delete
Delete a local provider profilegdrive profile list
List provider profilesgdrive profile rename
Rename a local provider profilegdrive profile use
Set the default provider profilegdrive reply
Manage Drive comment repliesgdrive reply create
Create a reply--body
string
Reply body--comment
string
Comment selector--content
string
Alias for --body--file
string
File selector--notify
bool
Send Google Drive reply notifications--yes
bool
Confirm creating without sending notificationsgdrive reply delete
Delete a reply--comment
string
Comment selector--dry-run
bool
Preview reply deletion without deleting--file
string
File selector--reply
string
Reply selector--yes
bool
Confirm reply deletiongdrive reply get
Get a reply--comment
string
Comment selector--file
string
File selector--reply
string
Reply selectorgdrive reply list
List comment replies--comment
string
Comment selector--file
string
File selectorgdrive reply update
Update a reply--body
string
Updated reply body--comment
string
Comment selector--content
string
Alias for --body--file
string
File selector--notify
bool
Send Google Drive reply notifications--reply
string
Reply selector--yes
bool
Confirm updating without sending notificationsgdrive resolve
Resolve a local ref, short id, or URL aliasgdrive revision
Manage Drive revisionsgdrive revision delete
Delete a revision--dry-run
bool
Preview revision deletion without deleting--file
string
File selector--revision
string
Revision selector--yes
bool
Confirm revision deletiongdrive revision download
download a revision--file
string
File selector--out
string
Output file path--revision
string
Revision selectorgdrive revision export
export a revision--file
string
File selector--mime-type
string
Export MIME type hint--out
string
Output file path--revision
string
Revision selectorgdrive revision get
Get a revision--file
string
File selector--revision
string
Revision selectorgdrive revision keep
keep a revision--file
string
File selector--revision
string
Revision selectorgdrive revision list
List file revisions--file
string
File selectorgdrive revision unkeep
unkeep a revision--file
string
File selector--revision
string
Revision selectorgdrive schema
Emit gdrive schema hints--in
bool
Show input schema--input
bool
Show input schema--out
bool
Show output schemagdrive shortcut
Manage Drive shortcutsgdrive shortcut create
Create a Drive shortcut--folder
string
Destination folder selector--name
string
Shortcut name--target
string
Shortcut target file or folder selectorgdrive shortcut delete
Permanently delete a shortcut--dry-run
bool
Preview permanent shortcut deletion without deleting--shortcut
string
Shortcut selector--yes
bool
Confirm permanent shortcut deletiongdrive shortcut get
Get shortcut metadata--shortcut
string
Shortcut selectorgdrive shortcut update
Update shortcut metadata--name
string
New shortcut name--shortcut
string
Shortcut selectorgdrive version
Show gdrive version informationplay_circle Live Examples
Output captured from a real workspace. Regenerate with
scripts/gen-docs.sh --update.
auth
Authenticated as kestrelphilip@gmail.com Credential type: Google OAuth refresh token grant Profile: kestrelphilip@gmail.com Next steps: - Files: gdrive file list --limit 10 - Capabilities: gdrive capabilities
Authenticated as kestrelphilip@gmail.com Credential type: Google OAuth refresh token grant Profile: kestrelphilip@gmail.com Next steps: - Files: gdrive file list --limit 10 - Capabilities: gdrive capabilities
INVALID_ARGUMENT: unknown flag: --{id}
Next steps:
- Help: gdrive --help
- File help: gdrive file list --help
- Folder help: gdrive folder list --help
- Auth status: gdrive auth status
exit status 2files
REF NAME STATE UPDATED
f2 {id}.txt active Mon 06 Jul 10:49
f1 {id}.txt active Mon 06 Jul 10:49
f3 {id} active Mon 06 Jul 10:49
f4 {id} active Fri 12 Jun 17:59
f5 {id} active Fri 12 Jun 16:51
Next steps:
- More: gdrive file list --cursor c1 --limit 10
- Open: gdrive file get f2
- Search: gdrive file search --query project --limit 10
- Files: gdrive file list --limit 10f1 {id}.txt
Field Value
-------------- -----
Type text/plain
State active
Size 77 B
Owner Philip Kestrel
Parent d1 {id}
Parent ID {id}
Created Mon 06 Jul 10:49
Modified Mon 06 Jul 10:49
URL [u1]
Local ref f1
Drive ID {id}
Display ID 1_5…L_X
MIME type text/plain
Created exact 2026-07-06T08:49:47.652Z
Modified exact 2026-07-06T08:49:47.652Z
Shared false
Starred false
Google file false
Download URL [u2]
MD5 {id}
URLs:
- [u1] https://drive.google.com
- [u2] https://drive.google.com
Next steps:
- Permissions: gdrive permission list --file f1
- Download: gdrive file download f1 --out ./download.bin
- Trash: gdrive file trash f1
- Update: gdrive file update f1f1 file {id}.txt
Field Value
---------- -----
Local ref f1
Type file
Title {id}.txt
Drive ID {id}
Display ID 1_5…L_X
Next steps:
- Inspect: gdrive file get f1 --view full
- Permissions: gdrive permission list --file f1
- JSON: gdrive resolve f1 --jsonREF NAME STATE UPDATED
f2 {id}.txt active Mon 06 Jul 10:49
f1 {id}.txt active Mon 06 Jul 10:49
f3 {id} active Mon 06 Jul 10:49
f4 {id} active Fri 12 Jun 17:59
f5 {id} active Fri 12 Jun 16:51
Next steps:
- More: gdrive file search --query eval --cursor c2 --limit 10
- Open: gdrive file get f2
- List: gdrive file list --limit 10
- Status: gdrive auth statusNo files matched {id} in Drive (trash excluded).
Searched: query "{id}"; folder none; corpus user; shared drive none; trash excluded
Next steps:
- List: gdrive file list --limit 10
- Check trash: gdrive file search --query {id} --trashed --limit 10
- Schema: gdrive schema file.search --input --jsonDownload file bytes
Usage:
gdrive file download [file] [flags]
Examples:
gdrive file download
gdrive file download --json
gdrive file download f1 --out ./notes.txt
gdrive file search --query notes --jsonl | gdrive file download --out ./notes.txt
Flags:
--acknowledge-abuse Confirm you understand Google flagged this file as abusive or malware and still want to download it
--file string File selector
-h, --help help for download
--out string Output path
--stdout Write bytes to stdout explicitly
Global Flags:
--config string Config path override
--cursor string Continuation cursor
--debug Enable debug diagnostics
--json Emit JSON machine output
--jsonl Emit JSONL records for piping
--limit int Maximum items to emit (default 50)
--no-paginate Fetch only one page
-o, --output string Compatibility output mode: json|jsonl. Prefer --json or --jsonl
--page-size int Requested upstream page size (default 50)
--profile string Config/auth profile (default "default")
-q, --quiet Suppress non-essential diagnostics
-v, --version Print version information
--view string View mode: summary|full (default "summary")Downloaded file f1
Field Value
--------- -----
Path /tmp/{id}/{id}.downloaded.txt
Bytes 77
MIME type text/plain
Next steps:
- File: gdrive file get f1
- Files: gdrive file list --limit 10
- Folders: gdrive folder list --limit 10Export a Google Docs file
Usage:
gdrive file export [file] [flags]
Examples:
gdrive file export
gdrive file export --json
gdrive file export f1 --mime-type application/pdf --out ./doc.pdf
gdrive file export f1 --mime-type text/plain --out ./doc.txt
Flags:
--file string File selector
--format string Friendly export format: pdf, docx, xlsx, pptx, txt, or csv
-h, --help help for export
--mime-type string Export MIME type (default "text/plain")
--out string Output path
--stdout Write bytes to stdout explicitly
Global Flags:
--config string Config path override
--cursor string Continuation cursor
--debug Enable debug diagnostics
--json Emit JSON machine output
--jsonl Emit JSONL records for piping
--limit int Maximum items to emit (default 50)
--no-paginate Fetch only one page
-o, --output string Compatibility output mode: json|jsonl. Prefer --json or --jsonl
--page-size int Requested upstream page size (default 50)
--profile string Config/auth profile (default "default")
-q, --quiet Suppress non-essential diagnostics
-v, --version Print version information
--view string View mode: summary|full (default "summary")Uploaded file f6
Field Value
----------- -----
Name {id}.txt
Source /tmp/{id}/{id}.txt
Folder {id}
Bytes read 81 B
MIME type text/plain
Checksum {id}
Upload mode multipart
Link [u3]
URLs:
- [u3] https://drive.google.com
Next steps:
- Verify: gdrive file get f6 --view full
- Download: gdrive file download f6 --out ./{id}.txt
- Resolve IDs: gdrive resolve f6 --json
- Clean up: gdrive file trash f6Upload a local file
Usage:
gdrive file upload [flags]
Examples:
gdrive file upload --help
gdrive file upload --json
gdrive file upload --path ./notes.txt --folder d1 --name notes.txt
gdrive folder search --query "Project docs" --jsonl | gdrive file upload --path ./notes.txt
Flags:
--description string File description
--folder string Parent folder selector
-h, --help help for upload
--mime-type string Content MIME type
--name string Drive file name
--path string Local file path
--resumable Use a resumable Drive upload session
Global Flags:
--config string Config path override
--cursor string Continuation cursor
--debug Enable debug diagnostics
--json Emit JSON machine output
--jsonl Emit JSONL records for piping
--limit int Maximum items to emit (default 50)
--no-paginate Fetch only one page
-o, --output string Compatibility output mode: json|jsonl. Prefer --json or --jsonl
--page-size int Requested upstream page size (default 50)
--profile string Config/auth profile (default "default")
-q, --quiet Suppress non-essential diagnostics
-v, --version Print version information
--view string View mode: summary|full (default "summary")folders
REF NAME STATE UPDATED
d1 {id} active Mon 06 Jul 10:49
d2 {id} active Fri 12 Jun 17:59
d3 {id} active Fri 12 Jun 16:51
d4 {id} active Fri 12 Jun 15:33
d5 {id} active Fri 12 Jun 15:11
Next steps:
- Children: gdrive file list --folder d1 --limit 10
- Inspect: gdrive folder get d1 --view full
- More: gdrive folder list --cursor c3 --limit 10
- Open: gdrive folder get d1d1 {id}
Field Value
----------------- -----
Type folder
State active
Owner Philip Kestrel
Parent display ID 0AO…PVA
Parent ID {id}
Created Mon 06 Jul 10:49
Modified Mon 06 Jul 10:49
URL [u4]
Local ref d1
Drive ID {id}
Display ID 1KQ…FEC
MIME type application/vnd.google-apps.folder
Created exact 2026-07-06T08:49:45.822Z
Modified exact 2026-07-06T08:49:45.822Z
Shared false
Starred false
Google file true
URLs:
- [u4] https://drive.google.com
Next steps:
- Children: gdrive file list --folder d1 --limit 10
- Folders: gdrive folder list --limit 10
- Permissions: gdrive permission list --file d1
- Update: gdrive folder update d1INVALID_ARGUMENT: folder list looks up folders; it does not list folder children Next steps: - List children: gdrive file list --folder d1 --limit 10 - Lookup folder: gdrive folder list --query "Project docs" --limit 10 - Help: gdrive folder list --help exit status 2
No folders matched {id} in Drive (trash excluded).
Searched: query "{id}"; parent none; corpus user; shared drive none; trash excluded
Next steps:
- List: gdrive folder list --limit 10
- Check trash: gdrive folder search --query {id} --trashed --limit 10
- Schema: gdrive schema folder.search --input --jsonpermissions
Manage Drive permissions
Usage:
gdrive permission [flags]
gdrive permission [command]
Available Commands:
add Add a permission
get Get a file permission
list List file permissions
remove Remove a permission
update Update a permission
Flags:
-h, --help help for permission
Global Flags:
--config string Config path override
--cursor string Continuation cursor
--debug Enable debug diagnostics
--json Emit JSON machine output
--jsonl Emit JSONL records for piping
--limit int Maximum items to emit (default 50)
--no-paginate Fetch only one page
-o, --output string Compatibility output mode: json|jsonl. Prefer --json or --jsonl
--page-size int Requested upstream page size (default 50)
--profile string Config/auth profile (default "default")
-q, --quiet Suppress non-essential diagnostics
-v, --version Print version information
--view string View mode: summary|full (default "summary")
Use "gdrive permission [command] --help" for more information about a command.INVALID_ARGUMENT: public link sharing requires --yes Next steps: - Recover: inspect current access with `gdrive permission list --file f1`, then pass --yes to confirm exit status 2
REF KIND ROLE PRINCIPAL FILE r1 user owner kestrelphilip@gmail.com f1 Next steps: - Inspect: gdrive permission get --file f1 r1 --view full - File: gdrive file get f1 - Open: gdrive permission get --file f1 r1
alt_route Composition Patterns
Bridge your ecosystem with zero middleware.
# Search for a file, inspect metadata, then list its sharing permissions
gdrive file search --query "project notes" --limit 1 --jsonl \
| gdrive file get

gdrive comment listList file comments--filestring File selector