A fast, lightweight, and AI-agent friendly CLI for Google Drive. Manage files with zero friction.
| Problem | Solution |
|---|---|
| Manual Google Drive work | Automate everything from CLI |
| Slow, heavy tooling | Go binary, fast startup |
| Not AI-agent friendly | JSON output, explicit flags, clean exit codes |
- Complete Google Drive Integration: Upload, download, list, search, and manage files and folders
- Google Workspace Integration: Full support for Google Sheets, Docs, and Slides with read/write operations
- Admin SDK Support: Manage Google Workspace users and groups via Admin SDK Directory API
- Authentication: OAuth2 with device code fallback, multiple profiles, secure credential storage, service account support
- Shared Drives Support: Full support for Google Workspace Shared Drives
- Advanced Safety Controls: Dry-run mode, confirmation prompts, idempotent operations
- Rich CLI Interface: 50+ commands with help, examples, and multiple output formats (JSON, table)
- Production Logging: Structured logging with debug mode and trace correlation
- Cross-Platform: Works on macOS, Linux, and Windows
- Drive Activity API (v2) - Audit file and folder activity
- Drive Labels API (v2) - Structured metadata and custom taxonomy
- Drive Changes API (v3) - Real-time change tracking and sync
- Permission Auditing - Security analysis and bulk permission management
See docs/API-GUIDE.md for detailed API documentation.
# Install script (recommended)
curl -fsSL https://raw.githubusercontent.com/dl-alexandre/Google-Drive-CLI/master/install.sh | bash
# Homebrew
brew tap dl-alexandre/tap
brew install gdrv
# Build from source
git clone https://github.com/dl-alexandre/Google-Drive-CLI.git
cd Google-Drive-CLI
go build -o gdrv ./cmd/gdrvSee docs/INSTALLATION.md for all installation methods.
Generate and install shell completion scripts for bash, zsh, fish, and PowerShell.
# Load completion for current session
source <(gdrv completion bash)
# Install permanently (Linux)
gdrv completion bash > /etc/bash_completion.d/gdrv
# Install permanently (macOS with Homebrew bash-completion)
gdrv completion bash > /usr/local/etc/bash_completion.d/gdrv# Load completion for current session
source <(gdrv completion zsh)
# Install permanently
mkdir -p ~/.config/zsh/completions
gdrv completion zsh > ~/.config/zsh/completions/_gdrv
# Add to ~/.zshrc:
echo 'fpath+=(~/.config/zsh/completions)' >> ~/.zshrc# Load completion for current session
gdrv completion fish | source
# Install permanently
gdrv completion fish > ~/.config/fish/completions/gdrv.fish# Load completion for current session
gdrv completion powershell | Out-String | Invoke-Expression
# Install permanently (add to your PowerShell profile)
gdrv completion powershell > $PROFILE.CurrentUserCurrentHost-
Authenticate:
gdrv auth login
Default is full read/write access. Use
--preset workspace-basicfor read-only. -
List files:
gdrv files list
-
Upload a file:
gdrv files upload myfile.txt
-
Download a file:
gdrv files download 1abc123... --output downloaded.txt
-
Download a Google Doc as text:
gdrv files download 1abc123... --doc
# OAuth2 (opens browser)
gdrv auth login
# Device code (headless)
gdrv auth device
# Service account
gdrv auth service-account --key-file ./service-account.json
# Multiple profiles
gdrv auth login --profile work
gdrv --profile work files listScope Presets:
workspace-full- Full read/write access (default)workspace-basic- Read-only accessadmin- Admin SDK for user/group managementworkspace-complete- All APIs including Activity, Labels, and Changes
See docs/AUTHENTICATION.md for complete authentication documentation.
# Always use --json for machine-readable output
gdrv files list --json
# Auto-pagination to get all results
gdrv files list --paginate --json
# Preview destructive operations
gdrv files delete 1abc123... --dry-run
# Sort and filter
gdrv files list --query "mimeType = 'application/pdf'" --order-by "modifiedTime desc" --jsonSee docs/AGENTS.md for complete AI agent best practices.
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Authentication required |
| 3 | Invalid argument |
| 4 | Resource not found |
| 5 | Permission denied |
| 6 | Rate limited |
- Installation Guide - All installation methods
- Authentication Guide - OAuth flows, scope presets, service accounts
- API Guide - Complete command reference
- AI Agent Best Practices - JSON output, pagination, exit codes
- Troubleshooting - Common issues and solutions
- Changelog - Release history
Config file locations:
- macOS:
~/Library/Application Support/gdrv/config.json - Linux:
~/.config/gdrv/config.json - Windows:
%APPDATA%\gdrv\config.json
Environment variables:
export GDRV_PROFILE=work
export GDRV_CONFIG_DIR=/path/to/config
export GDRV_REQUIRE_CUSTOM_OAUTH=1- Privacy Policy - How we handle your data (we don't collect any)
- Terms of Service - License, warranty, and usage terms
TL;DR: gdrv stores credentials locally encrypted, contacts only Google APIs, collects zero data, and is fully open source.
- Fork the repository
- Create a feature branch
- Make changes with tests
- Run
go test ./... - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.