---
name: gog-drive
description: "Google Drive via the gog CLI: list/search/tree files, upload/download, copy/move/rename, manage sharing and permissions, audit sharing exposure, and read activity. Use for Drive automation and read-only sharing/security audits with JSON output."
---

# gog drive

Drive reads, writes, and sharing audits with parseable output. Pick the account
on every call with `--account <email>` (or set `GOG_ACCOUNT`).

## Reads

```bash
gog --account you@example.com drive ls --max 20 --json --wrap-untrusted
gog --account you@example.com drive search "name contains 'report'" --json
gog --account you@example.com drive get <fileId> --json
gog --account you@example.com drive tree <folderId> --json
gog --account you@example.com drive permissions <fileId> --json
```

## Audit (read-only — risky-surface reporting)

```bash
gog --account you@example.com drive audit sharing --json     # find publicly/broadly shared files
gog --account you@example.com drive audit user <email> --json
gog --account you@example.com drive activity query --json
```

## Writes

```bash
gog --account you@example.com drive upload ./file.txt --parent <folderId> --json
gog --account you@example.com drive download <fileId> -o ./out
gog --account you@example.com drive mkdir "New Folder" --parent <folderId>
gog --account you@example.com drive copy <fileId> --json
gog --account you@example.com drive move <fileId> --parent <folderId>
gog --account you@example.com drive share <fileId> --email a@b.com --role reader
gog --account you@example.com drive unshare <fileId> --email a@b.com
gog --account you@example.com drive delete <fileId> --force
gog --account you@example.com drive bulk remove-public --query "..." --dry-run
```

## Safety

- `delete`, `unshare`, and `bulk *` are destructive — `--dry-run` first, then
  `--force` only for the exact change the user requested. `delete` trashes/removes;
  there is no undo for bulk operations.
- Sharing changes alter who can access data — confirm file id, principal, and role.
- `audit *` is read-only; safe to run for security reviews.
- stdout is data (`--json`/`--plain`); hints go to stderr. `--no-input` in automation.

## Discovery

`gog drive --help` · `gog drive <cmd> --help` · `gog schema drive <cmd> --json`
Reference: <https://gogcli.sh/>
