check
Verify configuration and connectivity.
```bash
python scripts/google-drive.py check
```
This validates:
- Python dependencies are installed
- Authentication is configured
- Can connect to Google Drive API
- Displays your email address and storage usage
auth setup
Store OAuth 2.0 client credentials for custom OAuth flow.
```bash
python scripts/google-drive.py auth setup \
--client-id YOUR_CLIENT_ID \
--client-secret YOUR_CLIENT_SECRET
```
Credentials are saved to ~/.config/agent-skills/google-drive.yaml.
files list
List files in your Drive.
```bash
# List recent files
python scripts/google-drive.py files list
# List with search query
python scripts/google-drive.py files list --query "name contains 'report'"
# List with max results
python scripts/google-drive.py files list --max-results 20
# List sorted by name
python scripts/google-drive.py files list --order-by "name"
# Output as JSON
python scripts/google-drive.py files list --json
```
Arguments:
--query: Drive search query (optional)--max-results: Maximum number of results (default: 10)--order-by: Sort order (default: "modifiedTime desc")--json: Output as JSON
files search
Search for files with filters.
```bash
# Search by name
python scripts/google-drive.py files search --name "quarterly report"
# Search by MIME type
python scripts/google-drive.py files search --mime-type "application/pdf"
# Search in a specific folder
python scripts/google-drive.py files search --folder FOLDER_ID
# Combine filters
python scripts/google-drive.py files search --name "budget" --mime-type "application/vnd.google-apps.spreadsheet"
# Output as JSON
python scripts/google-drive.py files search --name "report" --json
```
Arguments:
--name: File name to search for (partial match)--mime-type: MIME type filter--folder: Parent folder ID--json: Output as JSON
files get
Get file metadata by ID.
```bash
# Get file details
python scripts/google-drive.py files get FILE_ID
# Output as JSON
python scripts/google-drive.py files get FILE_ID --json
```
Arguments:
file_id: The file ID (required)--json: Output as JSON
files download
Download a file from Google Drive.
```bash
# Download a file
python scripts/google-drive.py files download FILE_ID --output /path/to/local/file
# Short form
python scripts/google-drive.py files download FILE_ID -o ./downloaded-file.pdf
```
Arguments:
file_id: The file ID (required)--output, -o: Output file path (required)
Note: Google Docs, Sheets, and Slides cannot be downloaded directly. Use the Google Drive web interface to export them.
files upload
Upload a file to Google Drive.
```bash
# Upload a file
python scripts/google-drive.py files upload /path/to/file.pdf
# Upload to a specific folder
python scripts/google-drive.py files upload /path/to/file.pdf --parent FOLDER_ID
# Upload with custom name
python scripts/google-drive.py files upload /path/to/file.pdf --name "Quarterly Report 2024"
# Upload with specific MIME type
python scripts/google-drive.py files upload /path/to/file --mime-type "text/csv"
# Output as JSON
python scripts/google-drive.py files upload /path/to/file.pdf --json
```
Arguments:
path: Local file path (required)--parent: Parent folder ID--mime-type: MIME type (auto-detected if not provided)--name: Name for the file in Drive--json: Output as JSON
folders create
Create a new folder.
```bash
# Create folder in root
python scripts/google-drive.py folders create "New Folder"
# Create folder inside another folder
python scripts/google-drive.py folders create "Subfolder" --parent FOLDER_ID
# Output as JSON
python scripts/google-drive.py folders create "Documents" --json
```
Arguments:
name: Folder name (required)--parent: Parent folder ID--json: Output as JSON
folders list
List contents of a folder.
```bash
# List folder contents
python scripts/google-drive.py folders list FOLDER_ID
# List with max results
python scripts/google-drive.py folders list FOLDER_ID --max-results 50
# Output as JSON
python scripts/google-drive.py folders list FOLDER_ID --json
```
Arguments:
folder_id: The folder ID (required)--max-results: Maximum number of results (default: 100)--json: Output as JSON
share
Share a file with a user.
```bash
# Share as reader (default)
python scripts/google-drive.py share FILE_ID --email user@example.com
# Share as writer
python scripts/google-drive.py share FILE_ID --email user@example.com --role writer
# Share as commenter
python scripts/google-drive.py share FILE_ID --email user@example.com --role commenter
# Share without sending notification
python scripts/google-drive.py share FILE_ID --email user@example.com --no-notify
# Output as JSON
python scripts/google-drive.py share FILE_ID --email user@example.com --json
```
Arguments:
file_id: File ID to share (required)--email: Email address to share with (required)--role: Permission role - reader, writer, commenter, owner (default: reader)--no-notify: Don't send notification email--json: Output as JSON
permissions list
List permissions for a file.
```bash
# List permissions
python scripts/google-drive.py permissions list FILE_ID
# Output as JSON
python scripts/google-drive.py permissions list FILE_ID --json
```
Arguments:
file_id: The file ID (required)--json: Output as JSON
permissions delete
Remove a permission from a file.
```bash
# Delete a permission
python scripts/google-drive.py permissions delete FILE_ID PERMISSION_ID
```
Arguments:
file_id: The file ID (required)permission_id: The permission ID to delete (required)