Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to apply wild card patterns while removing S3 folders

http://docs.aws.amazon.com/cli/latest/reference/s3/rm.html

s3://foo/2015-01-01/..
s3://foo/2015-01-02/..
s3://foo/2015-01-03/..
..
s3://foo/2016-01-01/..
s3://foo/2016-01-02/..
s3://foo/2016-01-03/..

In the above setup, I would like to apply wild card on my removals.

e.g. aws s3 rm s3://foo/2015* 
or
aws s3 rm s3://foo/2016-02-* 

I am unable to achieve this with the existing command, is it achievable since I have large number of files to delete and I would like to run commands in parallel for faster deletes.

like image 637
Rpj Avatar asked Dec 19 '22 14:12

Rpj


1 Answers

Currently, there is no support for the use of UNIX style wildcards in a command's path arguments, but you can use --exclude "<value>" and --include "<value>" parameters that can achieve the desired result:

aws s3 rm s3://foo/ --recursive --exclude "*" --include "2016-02-*" --dryrun
like image 181
Dusan Bajic Avatar answered Apr 12 '23 23:04

Dusan Bajic