folder
cmdhub adapter

Google Drive CLI
for cmdhub.

Files, folders, metadata, trash, and sharing permissions from the terminal.

lock Auth: OAuth2
Quick Install 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/drive

terminal 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 information
gdrive auth Manage Google Drive authentication
#cmd-gdrive-auth discovery safe
$ gdrive auth --help
gdrive auth login Authenticate with Google Drive
#cmd-gdrive-auth-login mutates state
Authenticate with a Google OAuth grant. The normal login path uses the built-in cmdhub Google Desktop app client, loopback redirect, PKCE, and the shared credential backend. Do not enter a normal Google account password, app password, browser cookie, Google session token, API key, or gcloud/ADC credential.
--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 credential
$ gdrive auth login
$ gdrive auth login --help
$ gdrive auth login --service-account --key-file service-account.json --delegate user@example.com
$ gdrive auth status
gdrive auth logout Remove stored credentials
#cmd-gdrive-auth-logout mutates state
Remove the selected profile’s stored Google OAuth grant and delegated service-account credential from the shared credential backend.
$ gdrive auth login
$ gdrive auth logout
$ gdrive auth logout --help
gdrive auth refresh Refresh stored token
#cmd-gdrive-auth-refresh mutates state
Refresh or validate the selected profile’s Google OAuth grant or delegated service-account token.
$ gdrive auth refresh
$ gdrive auth refresh --help
gdrive auth status Show auth status
#cmd-gdrive-auth-status discovery safe
Show whether the selected profile has a stored Google OAuth grant or Google Workspace delegated service-account credential, required Drive scopes, credential backend, and recovery command.
$ gdrive auth status
$ gdrive auth status --help
gdrive auth whoami Show current Drive identity
#cmd-gdrive-auth-whoami discovery safe
Show the Google Drive identity for the selected profile without exposing OAuth tokens, refresh tokens, service-account private keys, cookies, passwords, or session tokens.
$ gdrive auth whoami
$ gdrive auth whoami --help
gdrive capabilities Describe capabilities
#cmd-gdrive-capabilities discovery safe
--section string Show one capability section: scopes, schemas, or commands
$ gdrive capabilities --help
gdrive change Inspect Drive change tokens and changes
#cmd-gdrive-change discovery safe
$ gdrive change --help
gdrive change list List Drive changes from a page token
#cmd-gdrive-change-list discovery safe
--page-token string Drive changes page token
$ gdrive change list
$ gdrive change list --json
$ gdrive change list --page-token <token> --limit 10
gdrive change start-token Get a Drive changes start page token
#cmd-gdrive-change-start-token discovery safe
$ gdrive change start-token
$ gdrive change start-token --json
gdrive comment Manage Drive comments
#cmd-gdrive-comment mutates state
$ gdrive comment --help
gdrive comment create Create a comment
#cmd-gdrive-comment-create mutates state
--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 notifications
$ gdrive comment create --file f1 --body "Needs review" --notify
$ gdrive comment create --file f1 --body "Needs review" --yes
$ gdrive comment create --help
$ gdrive comment create --json
gdrive comment delete Delete a comment
#cmd-gdrive-comment-delete mutates state dry-run
--comment string Comment selector
--dry-run bool Preview comment deletion without deleting
--file string File selector
--yes bool Confirm comment deletion
$ gdrive comment delete --file f1 cm1 --dry-run
$ gdrive comment delete --file f1 cm1 --yes
$ gdrive comment delete --help
$ gdrive comment delete --json
gdrive comment get Get a comment
#cmd-gdrive-comment-get discovery safe
--comment string Comment selector
--file string File selector
$ gdrive comment get
$ gdrive comment get --file f1 cm1 --view full
$ gdrive comment get --json
gdrive comment list List file comments
#cmd-gdrive-comment-list discovery safe
--file string File selector
$ gdrive comment list
$ gdrive comment list --file f1
$ gdrive comment list --json
gdrive comment update Update a comment
#cmd-gdrive-comment-update mutates state
--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 notifications
$ gdrive comment update --file f1 cm1 --body "Updated" --notify
$ gdrive comment update --file f1 cm1 --body "Updated" --yes
$ gdrive comment update --help
$ gdrive comment update --json
gdrive config Inspect local configuration
#cmd-gdrive-config discovery safe
$ gdrive config --help
gdrive config explain Explain resolved configuration
#cmd-gdrive-config-explain discovery safe
$ gdrive config explain --help
gdrive doctor Run gdrive diagnostics
#cmd-gdrive-doctor discovery safe
$ gdrive doctor
$ gdrive doctor --help
$ gdrive doctor --json
gdrive file Manage Drive files
#cmd-gdrive-file discovery safe
$ gdrive file --help
gdrive file copy Copy a Drive file
#cmd-gdrive-file-copy discovery safe
--description string Copied file description
--file string File selector
--folder string Destination folder selector
--name string Copied file name
$ gdrive file copy --help
$ gdrive file copy --json
$ gdrive file copy f1 --name "notes copy.txt" --folder d1
gdrive file create Create a metadata-only Drive file
#cmd-gdrive-file-create mutates state
--description string File description
--folder string Parent folder selector
--mime-type string Drive MIME type
--name string Drive file name
$ gdrive file create --help
$ gdrive file create --json
$ gdrive file create --name "Project notes" --mime-type application/vnd.google-apps.document --folder d1
gdrive file delete Permanently delete a file
#cmd-gdrive-file-delete mutates state dry-run
--all bool Confirm batch permanent deletion
--dry-run bool Preview permanent deletion without deleting
--file string File selector
--yes bool Confirm permanent deletion
$ gdrive file delete --all --yes f1 f2
$ gdrive file delete --help
$ gdrive file delete --json
$ gdrive file delete f1 --yes
gdrive file download Download file bytes
#cmd-gdrive-file-download discovery safe
--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 explicitly
$ 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
gdrive file export Export a Google Docs file
#cmd-gdrive-file-export discovery safe
--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 explicitly
$ 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
gdrive file get Get file metadata
#cmd-gdrive-file-get discovery safe
--file string File selector
$ gdrive file get
$ gdrive file get --json
$ gdrive file get f1
$ gdrive file get f1 f2
$ gdrive file search --query invoice --jsonl | gdrive file get
gdrive file list List files
#cmd-gdrive-file-list discovery safe
--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|shortcut
$ gdrive file list
$ gdrive file list --folder d1
$ gdrive file list --limit 10
$ gdrive file list --parent d1 --query notes
$ gdrive folder list --jsonl | gdrive file list --limit 10
gdrive file move Move a file to another folder
#cmd-gdrive-file-move discovery safe
--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 replacement
$ gdrive file move --help
$ gdrive file move f1 --to d2 --from d1
$ gdrive file search --query notes --jsonl | gdrive file move --to d2
gdrive file star Star a file
#cmd-gdrive-file-star discovery safe
--file string File selector
$ gdrive file star --help
$ gdrive file star --json
$ gdrive file star f1
gdrive file trash Move a file to trash
#cmd-gdrive-file-trash mutates state
--all bool Confirm batch trash
--file string File selector
$ gdrive file search --query old-notes --jsonl | gdrive file trash --all
$ gdrive file trash --all f1 f2
$ gdrive file trash --help
$ gdrive file trash --json
$ gdrive file trash f1
gdrive file unstar Unstar a file
#cmd-gdrive-file-unstar discovery safe
--file string File selector
$ gdrive file unstar --help
$ gdrive file unstar --json
$ gdrive file unstar f1
gdrive file untrash Restore a file from trash
#cmd-gdrive-file-untrash mutates state
--all bool Confirm batch untrash
--file string File selector
$ gdrive file search --query old-notes --trashed --jsonl | gdrive file untrash --all
$ gdrive file untrash --all f1 f2
$ gdrive file untrash --help
$ gdrive file untrash --json
$ gdrive file untrash f1
gdrive file update Update file metadata or parents
#cmd-gdrive-file-update mutates state
--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 starred
$ gdrive file update --help
$ gdrive file update --json
$ gdrive file update f1 --add-parent d2 --remove-parent d1
$ gdrive file update f1 --description "Updated notes"
$ gdrive file update f1 --name renamed.txt
gdrive file upload Upload a local file
#cmd-gdrive-file-upload mutates state
--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 session
$ 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
gdrive folder Manage Drive folders
#cmd-gdrive-folder discovery safe
$ gdrive folder --help
gdrive folder create Create a folder
#cmd-gdrive-folder-create mutates state
--description string Folder description
--name string Folder name
--parent string Parent folder selector
$ gdrive folder create --help
$ gdrive folder create --json
$ gdrive folder create --name "Project docs"
$ gdrive folder create --name Archive --parent d1
gdrive folder delete Permanently delete a folder
#cmd-gdrive-folder-delete mutates state dry-run
--dry-run bool Preview permanent deletion without deleting
--folder string Folder selector
--yes bool Confirm permanent deletion
$ gdrive folder delete --help
$ gdrive folder delete --json
$ gdrive folder delete d1 --yes
gdrive folder get Get folder metadata
#cmd-gdrive-folder-get discovery safe
$ gdrive folder get
$ gdrive folder get --json
$ gdrive folder get d1
$ gdrive folder get d1 d2
$ gdrive folder list --jsonl | gdrive folder get
gdrive folder list Look up folders by name, parent, or shared drive
#cmd-gdrive-folder-list discovery safe
--parent string Parent folder selector
--query string Folder name query
--shared-drive string Shared drive selector
--trashed bool Include trashed folders
$ gdrive file list --folder d1 --limit 10
$ gdrive folder list
$ gdrive folder list --limit 10
$ gdrive folder list --query "Project docs"
gdrive folder move Move a folder to another folder
#cmd-gdrive-folder-move discovery safe
--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 replacement
$ gdrive folder move --help
$ gdrive folder move d1 --to d2
$ gdrive folder move d1 --to d2 --from d3
gdrive folder trash Move a folder to trash
#cmd-gdrive-folder-trash mutates state
--folder string Folder selector
$ gdrive folder trash --help
$ gdrive folder trash --json
$ gdrive folder trash d1
gdrive folder untrash Restore a folder from trash
#cmd-gdrive-folder-untrash mutates state
--folder string Folder selector
$ gdrive folder untrash --help
$ gdrive folder untrash --json
$ gdrive folder untrash d1
gdrive folder update Update folder metadata
#cmd-gdrive-folder-update mutates state
--description string New folder description
--folder string Folder selector
--name string New folder name
$ gdrive folder update --help
$ gdrive folder update --json
$ gdrive folder update d1 --name "Project docs"
gdrive mcp Run the MCP server
#cmd-gdrive-mcp discovery safe

Run 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 2m
$ mcp
$ mcp --print-config
gdrive permission Manage Drive permissions
#cmd-gdrive-permission discovery safe
$ gdrive permission --help
gdrive permission add Add a permission
#cmd-gdrive-permission-add mutates state
--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 sends
$ gdrive permission add --file f1 --type anyone --role reader --yes
$ gdrive permission add --file f1 --type user --email user@example.com
$ gdrive permission add --help
$ gdrive permission add --json
gdrive permission get Get a file permission
#cmd-gdrive-permission-get discovery safe
--file string File selector
--permission string Permission selector
$ gdrive permission get
$ gdrive permission get --file f1 r1 --view full
gdrive permission list List file permissions
#cmd-gdrive-permission-list discovery safe
--file string File selector
$ gdrive file search --query notes --jsonl | gdrive permission list
$ gdrive permission list
$ gdrive permission list --file f1
$ gdrive permission list --json
gdrive permission remove Remove a permission
#cmd-gdrive-permission-remove mutates state dry-run
--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 removal
$ gdrive permission remove --file f1 --permission r1 --yes
$ gdrive permission remove --file f1 r1 --dry-run
$ gdrive permission remove --file f1 r1 --yes
$ gdrive permission remove --help
$ gdrive permission remove --json
gdrive permission update Update a permission
#cmd-gdrive-permission-update mutates state
--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 update
$ gdrive permission update --file f1 r1 --role writer --yes
$ gdrive permission update --help
gdrive profile Manage provider profiles
#cmd-gdrive-profile discovery safe
$ gdrive profile --help
gdrive profile create Create an unauthenticated provider profile
#cmd-gdrive-profile-create mutates state
$ gdrive profile create --help
gdrive profile delete Delete a local provider profile
#cmd-gdrive-profile-delete mutates state
$ gdrive profile delete --help
gdrive profile list List provider profiles
#cmd-gdrive-profile-list discovery safe
$ gdrive profile list --help
gdrive profile rename Rename a local provider profile
#cmd-gdrive-profile-rename discovery safe
$ gdrive profile rename --help
gdrive profile use Set the default provider profile
#cmd-gdrive-profile-use mutates state
$ gdrive profile use --help
gdrive reply Manage Drive comment replies
#cmd-gdrive-reply mutates state
$ gdrive reply --help
gdrive reply create Create a reply
#cmd-gdrive-reply-create mutates state
--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 notifications
$ gdrive reply create --file f1 --comment cm1 --body "Done" --notify
$ gdrive reply create --file f1 --comment cm1 --body "Done" --yes
$ gdrive reply create --help
$ gdrive reply create --json
gdrive reply delete Delete a reply
#cmd-gdrive-reply-delete mutates state dry-run
--comment string Comment selector
--dry-run bool Preview reply deletion without deleting
--file string File selector
--reply string Reply selector
--yes bool Confirm reply deletion
$ gdrive reply delete --file f1 --comment cm1 rp1 --dry-run
$ gdrive reply delete --file f1 --comment cm1 rp1 --yes
$ gdrive reply delete --help
$ gdrive reply delete --json
gdrive reply get Get a reply
#cmd-gdrive-reply-get discovery safe
--comment string Comment selector
--file string File selector
--reply string Reply selector
$ gdrive reply get
$ gdrive reply get --file f1 --comment cm1 rp1 --view full
$ gdrive reply get --json
gdrive reply list List comment replies
#cmd-gdrive-reply-list discovery safe
--comment string Comment selector
--file string File selector
$ gdrive reply list
$ gdrive reply list --file f1 --comment cm1
$ gdrive reply list --json
gdrive reply update Update a reply
#cmd-gdrive-reply-update mutates state
--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 notifications
$ gdrive reply update --file f1 --comment cm1 rp1 --body "Updated" --notify
$ gdrive reply update --file f1 --comment cm1 rp1 --body "Updated" --yes
$ gdrive reply update --help
$ gdrive reply update --json
gdrive resolve Resolve a local ref, short id, or URL alias
#cmd-gdrive-resolve discovery safe
$ gdrive resolve --help
$ gdrive resolve <ref>
gdrive revision Manage Drive revisions
#cmd-gdrive-revision discovery safe
$ gdrive revision --help
gdrive revision delete Delete a revision
#cmd-gdrive-revision-delete mutates state dry-run
--dry-run bool Preview revision deletion without deleting
--file string File selector
--revision string Revision selector
--yes bool Confirm revision deletion
$ gdrive revision delete --file f1 rv1 --dry-run
$ gdrive revision delete --file f1 rv1 --yes
$ gdrive revision delete --help
$ gdrive revision delete --json
gdrive revision download download a revision
#cmd-gdrive-revision-download discovery safe
--file string File selector
--out string Output file path
--revision string Revision selector
$ gdrive revision download
$ gdrive revision download --file f1 rv1 --out ./revision.bin
$ gdrive revision download --json
gdrive revision export export a revision
#cmd-gdrive-revision-export discovery safe
--file string File selector
--mime-type string Export MIME type hint
--out string Output file path
--revision string Revision selector
$ gdrive revision export
$ gdrive revision export --file f1 rv1 --out ./revision.bin
$ gdrive revision export --json
gdrive revision get Get a revision
#cmd-gdrive-revision-get discovery safe
--file string File selector
--revision string Revision selector
$ gdrive revision get
$ gdrive revision get --file f1 rv1 --view full
$ gdrive revision get --json
$ gdrive revision list --file f1 --jsonl | gdrive revision get --file f1
gdrive revision keep keep a revision
#cmd-gdrive-revision-keep discovery safe
--file string File selector
--revision string Revision selector
$ gdrive revision keep --file f1 rv1
$ gdrive revision keep --help
$ gdrive revision keep --json
gdrive revision list List file revisions
#cmd-gdrive-revision-list discovery safe
--file string File selector
$ gdrive revision list
$ gdrive revision list --file f1
$ gdrive revision list --json
$ gdrive revision list f1
gdrive revision unkeep unkeep a revision
#cmd-gdrive-revision-unkeep discovery safe
--file string File selector
--revision string Revision selector
$ gdrive revision unkeep --file f1 rv1
$ gdrive revision unkeep --help
$ gdrive revision unkeep --json
gdrive schema Emit gdrive schema hints
#cmd-gdrive-schema discovery safe
--in bool Show input schema
--input bool Show input schema
--out bool Show output schema
$ gdrive schema
$ gdrive schema --help
$ gdrive schema file.get --out --json
$ gdrive schema file.upload --input
gdrive shared-drive Discover shared drives
#cmd-gdrive-shared-drive discovery safe
$ gdrive shared-drive --help
gdrive shared-drive get Get shared drive metadata
#cmd-gdrive-shared-drive-get discovery safe
--shared-drive string Shared drive selector
$ gdrive shared-drive get
$ gdrive shared-drive get sd1 --view full
gdrive shared-drive list List shared drives
#cmd-gdrive-shared-drive-list discovery safe
--query string Shared drive name query
$ gdrive shared-drive list
$ gdrive shared-drive list --limit 10
gdrive shortcut Manage Drive shortcuts
#cmd-gdrive-shortcut discovery safe
$ gdrive shortcut --help
gdrive shortcut create Create a Drive shortcut
#cmd-gdrive-shortcut-create mutates state
--folder string Destination folder selector
--name string Shortcut name
--target string Shortcut target file or folder selector
$ gdrive shortcut create --help
$ gdrive shortcut create --json
$ gdrive shortcut create --target f1 --folder d1 --name "Proposal shortcut"
gdrive shortcut delete Permanently delete a shortcut
#cmd-gdrive-shortcut-delete mutates state dry-run
--dry-run bool Preview permanent shortcut deletion without deleting
--shortcut string Shortcut selector
--yes bool Confirm permanent shortcut deletion
$ gdrive shortcut delete --help
$ gdrive shortcut delete --json
$ gdrive shortcut delete f1 --dry-run
$ gdrive shortcut delete f1 --yes
gdrive shortcut get Get shortcut metadata
#cmd-gdrive-shortcut-get discovery safe
--shortcut string Shortcut selector
$ gdrive shortcut get
$ gdrive shortcut get --json
$ gdrive shortcut get f1 --view full
gdrive shortcut update Update shortcut metadata
#cmd-gdrive-shortcut-update mutates state
--name string New shortcut name
--shortcut string Shortcut selector
$ gdrive shortcut update --help
$ gdrive shortcut update --json
$ gdrive shortcut update f1 --name "Proposal shortcut"
gdrive version Show gdrive version information
#cmd-gdrive-version discovery safe
$ gdrive version --help

play_circle Live Examples

Output captured from a real workspace. Regenerate with scripts/gen-docs.sh --update.

auth

Check Drive auth readiness
$ gdrive auth status
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
Check current Drive identity
$ gdrive auth whoami
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
Recover from an invalid auth flag
$ gdrive auth status --cmdhub-invalid-flag
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 2

files

List recent files
$ gdrive file list --limit 5
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 10
Inspect a file in full view
$ gdrive file get 1_5dAQcu7J-thBrIqfKu4164IO6j0El_X --view full
f1  {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 f1
Resolve a file local ref
$ gdrive resolve 1_5dAQcu7J-thBrIqfKu4164IO6j0El_X --view full
f1  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 --json
Search files
$ gdrive file search --query eval --limit 5
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 search --query eval --cursor c2 --limit 10
- Open:   gdrive file get f2
- List:   gdrive file list --limit 10
- Status: gdrive auth status
Empty file search
$ gdrive file search --query cmdhub-docshot-no-such-file-token --limit 3
Empty state
No 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 --json
File download help
$ gdrive file download --help
Download 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")
Download a disposable file
$ gdrive file download 1_5dAQcu7J-thBrIqfKu4164IO6j0El_X --out /tmp/cmdhub-gdrive-docshot-cmdhub-eval-gdrive-docshot-20260706t084944z-ee3f3e94-_o9v6c7h/cmdhub-gdrive-docshot-cmdhub-eval-gdrive-docshot-20260706t084944z-ee3f3e94.downloaded.txt
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 10
File export help
$ gdrive file export --help
Export 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")
Upload a disposable file
$ gdrive file upload --path /tmp/cmdhub-gdrive-docshot-cmdhub-eval-gdrive-docshot-20260706t084944z-ee3f3e94-_o9v6c7h/cmdhub-gdrive-docshot-cmdhub-eval-gdrive-docshot-20260706t084944z-ee3f3e94-upload-result.txt --folder 1kq8V45Z0Pm5WDjJeGR20Fp-MVh0-ufeC --name cmdhub-gdrive-docshot-cmdhub-eval-gdrive-docshot-20260706t084944z-ee3f3e94-captured-upload.txt
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 f6
File upload help
$ gdrive file upload --help
Upload 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

List folders
$ gdrive folder list --limit 5
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 d1
Inspect a folder
$ gdrive folder get 1kq8V45Z0Pm5WDjJeGR20Fp-MVh0-ufeC --view full
d1  {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 d1
Recover from folder child-listing confusion
$ gdrive folder list --folder d1
INVALID_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
Empty folder search
$ gdrive folder search --query cmdhub-docshot-no-such-folder-token --limit 3
Empty state
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 --json

permissions

Permission help
$ gdrive permission --help
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.
Show public permission guardrail
$ gdrive permission add --file 1_5dAQcu7J-thBrIqfKu4164IO6j0El_X --type anyone --role reader
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
List file permissions
$ gdrive permission list --file 1_5dAQcu7J-thBrIqfKu4164IO6j0El_X
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