Replies: 1 comment
|
AWS CLI does not have a single First run a dry run, then remove Dry run: for /L %i in (100000,1,109999) do @set "p=WO0%i" & aws s3 rm "s3://snw-bucket-staging/%p%/" --profile user-stg --recursive --dryrun Actual delete: for /L %i in (100000,1,109999) do @set "p=WO0%i" & aws s3 rm "s3://snw-bucket-staging/%p%/" --profile user-stg --recursive If your folder names require fixed-width zero padding, use PowerShell formatting from CMD: Dry run: for /L %i in (100000,1,109999) do @PowerShell -NoProfile -Command "$p=('WO{0:D7}' -f %i); aws s3 rm s3://snw-bucket-staging/$p/ --profile user-stg --recursive --dryrun" Actual delete: for /L %i in (100000,1,109999) do @PowerShell -NoProfile -Command "$p=('WO{0:D7}' -f %i); aws s3 rm s3://snw-bucket-staging/$p/ --profile user-stg --recursive" This deletes all objects under prefixes WO0100000 through WO0109999. |
Uh oh!
There was an error while loading. Please reload this page.
Hi have requirement to remove files using AWS CLI via CMD.
Example, here the command to delete all files under folder WO0123456
aws s3 rm s3://snw-bucket-staging/WO0123456 --profile user-stg
But how I can remove multiple folders at specific range with single line of AWS CLI command?
Example, I want to delete all files under folder range from WO0100000 until WO0109999
Thanks
All reactions