Reputation: 141
Is there a aws cli command that allows to download an entire folder from s3 to local machine, instead of creating a folder locally.
For example , when i run the following command
aws cp s3 s3://<MY-BUCKET>/folder1 . --recursive
I expect the "folder1" to downloaded to my local machine along with its contents.
Thanks in advance
Upvotes: 10
Views: 15266
Reputation: 270264
If you want it to copy folder1/
, you could use:
aws s3 cp s3://<MY-BUCKET>/ . --recursive --exclude '*' --include 'folder1/*'
This tells it to copy the root directory, but only include folder1/*
.
See: AWS CLI - Use of Exclude and Include Filters
Upvotes: 15
Reputation: 10195
You can use the sync
method of the s3 cli
aws s3 sync s3://<MY-BUCKET>/folder1 .
if you really need the folder, you could do something like
mkdir ./folder1
aws s3 sync s3://<MY-BUCKET>/folder1 ./folder1
Upvotes: 6