Describe the solution
Summary
wrangler r2 object currently supports get, put, and delete but has no list subcommand. There is no way to list objects in an R2 bucket using the wrangler CLI.
Use case
Emptying an R2 bucket before deletion. wrangler r2 bucket delete fails on non-empty buckets, but there's no wrangler command to discover what's in the bucket. This forces users to fall back to the CF REST API or external tools (AWS CLI, rclone) just to list objects.
Current workaround
# List via CF REST API (paginated)
curl -s "https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/r2/buckets/${BUCKET}/objects?per_page=100" \
-H "Authorization: Bearer ${API_TOKEN}" | jq -r '.result[].key'
# Then delete each object individually
wrangler r2 object delete "${BUCKET}/${KEY}" --remote
This requires mixing CF API calls with wrangler commands and manually handling pagination cursors.
Proposed solution
# List all objects in a bucket
wrangler r2 object list <bucket> [--remote] [--prefix <prefix>] [--delimiter <delimiter>]
# With JSON output for scripting
wrangler r2 object list <bucket> --remote --json
Environment
Describe the solution
Summary
wrangler r2 objectcurrently supportsget,put, anddeletebut has nolistsubcommand. There is no way to list objects in an R2 bucket using the wrangler CLI.Use case
Emptying an R2 bucket before deletion.
wrangler r2 bucket deletefails on non-empty buckets, but there's no wrangler command to discover what's in the bucket. This forces users to fall back to the CF REST API or external tools (AWS CLI, rclone) just to list objects.Current workaround
This requires mixing CF API calls with wrangler commands and manually handling pagination cursors.
Proposed solution
Environment