| name | jgdcli |
| description | Google Drive CLI (Java) for listing, searching, uploading, downloading, and sharing files and folders. |
Google Drive CLI (Java)
Command-line interface for Google Drive operations. Java port of gdcli.
Source: https://github.com/maxandersen/jgdcli
Installation
Option 1: Run directly with JBang (no install)
jbang jgdcli@maxandersen/skills --help
Option 2: Install as command
jbang app install jgdcli@maxandersen/skills
jgdcli --help
Setup
Google Cloud Console (one-time)
- Create a new project (or select existing)
- Enable the Google Drive API
- Set app name in OAuth branding
- Add test users (all Gmail addresses you want to use)
- Create OAuth client:
- Click "Create Client"
- Application type: "Desktop app"
- Download the JSON file
Configure jgdcli
First check if already configured:
jgdcli accounts list
If no accounts, guide the user through setup:
- Ask if they have a Google Cloud project with Drive API enabled
- If not, walk them through the Google Cloud Console steps above
- Have them download the OAuth credentials JSON
- Run:
jgdcli accounts credentials ~/path/to/credentials.json
- Run:
jgdcli accounts add <email> (use --manual for browserless OAuth)
Shared Credentials
Credentials in ~/.jgcli/ are shared across jgccli, jgmcli, and jgdcli. Set up once, use with all three.
For separate credentials, use named credentials:
jgdcli accounts credentials ~/work-creds.json --name work
jgdcli accounts add work@company.com --credentials work
Usage
Run jgdcli --help for full command reference.
Common operations:
jgdcli ls <email> [folderId] - List files/folders
jgdcli ls <email> --query "<query>" - List with Drive query filter
jgdcli search <email> "<text>" - Full-text content search
jgdcli download <email> <fileId> [destPath] - Download a file
jgdcli upload <email> <localPath> [--folder <folderId>] - Upload a file
jgdcli mkdir <email> <name> - Create a folder
jgdcli share <email> <fileId> --anyone - Share publicly
Search
Two different commands:
search "<text>" - Searches inside file contents (fullText)
ls --query "<query>" - Filters by metadata (name, type, date, etc.)
Use ls --query for filename searches!
Query Syntax (for ls --query)
Format: field operator value. Combine with and/or, group with ().
Operators: =, !=, contains, <, >, <=, >=
Examples:
jgdcli ls <email> --query "name = 'report.pdf'"
jgdcli ls <email> --query "name contains 'IMG'"
jgdcli ls <email> --query "mimeType = 'application/pdf'"
jgdcli ls <email> --query "mimeType contains 'image/'"
jgdcli ls <email> --query "mimeType = 'application/vnd.google-apps.folder'"
jgdcli ls <email> --query "modifiedTime > '2024-01-01'"
jgdcli ls <email> --query "'me' in owners"
jgdcli ls <email> --query "sharedWithMe"
jgdcli ls <email> --query "trashed = false"
jgdcli ls <email> --query "name contains 'report' and mimeType = 'application/pdf'"
Ref: https://developers.google.com/drive/api/guides/ref-search-terms
Data Storage
~/.jgcli/credentials.json - OAuth client credentials (shared with jgccli, jgmcli)
~/.jgcli/accounts-drive.json - Account tokens
~/.jgcli/downloads/ - Default download location