How do i use wildcards to copy group of files in AWS CLI

0 votes
For some reason, I am having trouble using * in AWS CLI to copy a group of files from a S3 bucket.

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

aws s3 cp s3://myfiles/file*

Any suggestions?
Jan 25, 2019 in AWS by datageek
• 3,090 points
17,225 views

2 answers to this question.

0 votes

If you are getting 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*"`

You can learn more from the AWS Training in Houston.

answered Jan 25, 2019 by Archana
• 5,640 points
+1 vote

Here's a UNIX/Linux shell way.

for f in `aws s3 ls my-bucket | awk '{print $NF}'`
do
  aws s3 cp s3://my-bucket/$f .
done

You can even check out the details of Migrating to AWS with the AWS Cloud Migration Course.

answered Feb 24, 2020 by paul

Related Questions In AWS

0 votes
1 answer

How to edit files in the AWS S3 bucket from CLI?

Hi@akhtar, According to my knowledge,  you can't edit ...READ MORE

answered Jun 8, 2020 in AWS by MD
• 95,440 points
8,990 views
0 votes
1 answer

how to get the list of aws services i am used in aws my account by using the lambda function

Hi@shalk, You can create a session in your ...READ MORE

answered Sep 24, 2020 in AWS by MD
• 95,440 points
2,232 views
0 votes
1 answer

AWS S3 uploading hidden files by default

versioning is enabled in your bucket. docs.aws.amazon.com/AmazonS3/latest/user-guide/….... the ...READ MORE

answered Oct 4, 2018 in AWS by Priyaj
• 58,090 points
5,460 views
–1 vote
1 answer

How to decrypt the encrypted S3 file using aws-encryption-cli --decrypt

Use command : aws s3 presign s3://mybucket/abc_count.png you get ...READ MORE

answered Oct 22, 2018 in AWS by Priyaj
• 58,090 points
4,871 views
0 votes
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP