Back

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

I'm having trouble using * in the AWS CLI to select a subset of files from a certain bucket.

Adding * to the path like this does not seem to work

aws s3 cp s3://data/2016-08*.

closed

2 Answers

0 votes
by (44.4k points)
selected by
 
Best answer

Downloading multiple files to your current directory from an aws bucket can be done by using recursive, exclude, and include flags like this:

aws s3 cp s3://data/ . --recursive --exclude "*" --include "*.filetype"

Where "filetype" is the extension, such as .jpg.

This below statement will exclude all files except that file type:

--exclude "*" --include "*.filetype"

This below statement will exclude all the files so keep do not do this

--include "*.txt" --exclude "*" 

For more information, check out this document from Amazon - https://docs.aws.amazon.com/cli/latest/reference/s3/#use-of-exclude-and-include-filters

0 votes
by (108k points)

If you are receiving an error when using '*', and if you want to download multiple files from an aws bucket to your current directory, you can use recursive, exclude, and include flags like this:

aws s3 cp s3://myfiles/ . --recursive --exclude "*" --include "file*"`

Hope this helps you!

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

Browse Categories

...