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

terminal Command Reference

Generated from source. Global flags apply to all commands.

Global Flags

--config string Config path override
--cursor string Continuation cursor
--debug bool Enable debug diagnostics
--json bool Alias for --output json
--jsonl bool Alias for --output jsonl
--limit int = 50 Maximum items to emit
--no-paginate bool Fetch only one page
--output, -o string = human Output mode: human|json|jsonl
--page-size int = 50 Requested upstream page size
--profile string = default Config/auth profile
--quiet, -q bool Suppress non-essential diagnostics
--trace-id string Trace identifier
--view string = summary View mode: summary|full

gdrive auth — Manage Google Drive authentication

gdrive auth login Authenticate with Google Drive
gdrive auth logout Remove stored credentials
gdrive auth refresh Refresh stored token
gdrive auth status Show auth status
gdrive auth whoami Show current Drive identity
gdrive capabilities Describe gdrive capabilities
gdrive doctor Run gdrive diagnostics

gdrive file — Manage Drive files

gdrive file delete Permanently delete a file
--file string File selector
--yes bool Confirm permanent deletion
$ gdrive file delete f1 --yes
gdrive file download Download file bytes
--file string File selector
--out string Output path. Omit to print content.
$ gdrive file download f1 --out ./notes.txt
$ gdrive file search --query notes --output jsonl | gdrive file download --out ./notes.txt
gdrive file export Export a Google Docs file
--file string File selector
--mime-type string = text/plain Export MIME type
--out string Output path. Omit to print content.
$ gdrive file export f1 --mime-type text/plain --out ./doc.txt
$ gdrive file export f1 --mime-type application/pdf --out ./doc.pdf
gdrive file get Get file metadata
--file string File selector
$ gdrive file get f1
$ gdrive file search --query invoice --output jsonl | gdrive file get
gdrive file list List files
--folder string Folder selector
--query string Name/full-text query
--trashed bool Include trashed files
$ gdrive file list --limit 10
$ gdrive file list --folder d1
$ gdrive folder list --output jsonl | gdrive file list --limit 10
gdrive file search Search files by name or text
--query string Name/full-text query
--trashed bool Include trashed files
$ gdrive file search --query invoice
$ gdrive file search --query "quarterly plan" --limit 5
gdrive file trash Move a file to trash
--file string File selector
$ gdrive file trash f1
$ gdrive file search --query old-notes --output jsonl | gdrive file trash
gdrive file untrash Restore a file from trash
--file string File selector
$ gdrive file untrash f1
$ gdrive file search --query old-notes --trashed --output jsonl | gdrive file untrash
gdrive 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 starred
$ gdrive file update f1 --name renamed.txt
$ gdrive file update f1 --description "Updated notes"
gdrive 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
$ gdrive file upload --path ./notes.txt --folder d1 --name notes.txt
$ gdrive folder search --query "Project docs" --output jsonl | gdrive file upload --path ./notes.txt

gdrive folder — Manage Drive folders

gdrive folder create Create a folder
--description string Folder description
--name string Folder name
--parent string Parent folder selector
$ gdrive folder create --name "Project docs"
$ gdrive folder create --name Archive --parent d1
gdrive folder get Get folder metadata
$ gdrive folder get d1
$ gdrive folder list --output jsonl | gdrive folder get
gdrive folder list List folders
--query string Folder name query
--trashed bool Include trashed folders
$ gdrive folder list --limit 10
$ gdrive folder list --query Project
gdrive folder search Search folders by name
--query string Folder name query
--trashed bool Include trashed folders
$ gdrive folder search --query "Project docs"
$ gdrive folder search --query archive --trashed

gdrive permission — Manage Drive permissions

gdrive 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
--role string = reader Permission role: reader|commenter|writer
--type string Permission type: user|group|domain|anyone (required)
--yes-public bool Confirm creation of a public anyone permission
$ gdrive permission add --file f1 --type user --email user@example.com
$ gdrive permission add --file f1 --type anyone --role reader --yes-public
gdrive permission list List file permissions
--file string File selector
$ gdrive permission list --file f1
$ gdrive file search --query notes --output jsonl | gdrive permission list
gdrive permission remove Remove a permission
--file string File selector
--permission string Permission selector
--yes bool Confirm permission removal
$ gdrive permission remove --file f1 r1 --yes
$ gdrive permission remove --file f1 --permission r1 --yes
gdrive resolve Resolve a marker, short id, or URL alias
gdrive schema Emit gdrive schema hints
--in bool Show input schema
--out bool Show output schema
gdrive version Show gdrive version information

play_circle Live Examples

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

auth

Check current Drive identity
$ gdrive auth whoami
Authenticated with Google as Philip Kestrel <kestrelphilip@gmail.com>

Stuck? Try `gdrive file list --limit 10`

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 --output jsonl \
  | gdrive file get