Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I have an S3 bucket in which there are several log files stored having the format index.log.yyyy-mm-dd-01 index.log.yyyy-mm-dd-02 . . .

yyyy for year, mm for month and dd for a date.

I want to download the entire bucket but what should I do if I want to do some pattern matching? I tried the following commands but they didn't work:

aws s3 sync s3://mybucket/index.log.2014-08-01-* .

aws s3 sync 's3://mybucket/index.log.2014-08-01-*' .

I also tried using s3cmd for downloading purpose using http://fosshelp.blogspot.in/2013/06 article's POINT 7 and http://s3tools.org/s3cmd-sync. Following were the commands that I ran:

s3cmd -c myconf.txt get --exclude '*.log.*' --include '*.2014-08-01-*' s3://mybucket/ .

s3cmd -c myconf.txt get --exclude '*.log.*' --include '*.2014-08-01-*' s3://mybucket/ .

and a few more permutations of this.

Can anyone tell me why isn't pattern matching happening? Or if there is any other tool that I need to use.

1 Answer

0 votes
by (44.4k points)

Solution:

aws s3 sync s3://mybucket . --exclude "*" --include "*.2014-08-01-*"

--exclude "*" should come before --include "---"

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
asked Jul 23, 2019 in AWS by yuvraj (19.1k points)
0 votes
1 answer

Browse Categories

...