Aish Mahesh
Aish Mahesh

Reputation: 231

AWS CLI command to copy specific files from S3 to local or hdfs

I am trying to copy a list of some files from my S3 bucket to local or my hdfs.My Bucket has more than 220000 objects and I just want to copy file starting with abc2018- to my local system. The list of files in abc2018- is more than 20k. I just took a sample file and tried copying it using the below command and I got succeeded: s3cmd get "s3://bucketname/abc2018-01-02.txt" ~/

If I want to copy all files with abc2018- to a home folder I don't have an option. Do I need to write any script or it can be achieved with s3cmd itself?

Upvotes: 2

Views: 9792

Answers (1)

You could try to use AWC Cli:

    aws s3 cp s3://bucketname/ ~/ --exclude "*" --include "abc2018-*" --recursive

This command copy only the pattern you want. Enjoy!

Upvotes: 10

Related Questions