0 votes
1 view
in AWS by (18.7k 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*.

2 Answers

0 votes
by (43.5k 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 (63.9k 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!

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...