Difference between revisions of "Aws s3"
From Wasya Wiki
(Created page with " == get size of bucket == aws s3 ls s3://your-bucket-name --recursive --summarize --human-readable") |
|||
| Line 3: | Line 3: | ||
aws s3 ls s3://your-bucket-name --recursive --summarize --human-readable | aws s3 ls s3://your-bucket-name --recursive --summarize --human-readable | ||
| + | |||
| + | == remove objects that start with ._ == | ||
| + | |||
| + | export bucket='your-bucket-name' | ||
| + | |||
| + | Preview: | ||
| + | |||
| + | aws s3api list-objects-v2 \ | ||
| + | --bucket $bucket \ | ||
| + | --query "Contents[?starts_with(Key, '._') || contains(Key, '/._')].Key" | ||
| + | |||
| + | execute: | ||
| + | |||
| + | aws s3api list-objects-v2 \ | ||
| + | --bucket $bucket \ | ||
| + | --query "Contents[?starts_with(Key, '._') || contains(Key, '/._')].Key" \ | ||
| + | --output text | tr '\t' '\n' | while read key; do | ||
| + | aws s3 rm "s3://$bucket/$key" | ||
| + | done | ||
Latest revision as of 15:22, 30 March 2026
get size of bucket
aws s3 ls s3://your-bucket-name --recursive --summarize --human-readable
remove objects that start with ._
export bucket='your-bucket-name'
Preview:
aws s3api list-objects-v2 \ --bucket $bucket \ --query "Contents[?starts_with(Key, '._') || contains(Key, '/._')].Key"
execute:
aws s3api list-objects-v2 \
--bucket $bucket \
--query "Contents[?starts_with(Key, '._') || contains(Key, '/._')].Key" \
--output text | tr '\t' '\n' | while read key; do
aws s3 rm "s3://$bucket/$key"
done