xxxxxxxxxx
Recursively copying local files to S3
When passed with the parameter --recursive, the following cp command recursively copies all files under a specified directory to a specified bucket and prefix while excluding some files by using an --exclude parameter. In this example, the directory myDir has the files test1.txt and test2.jpg:
aws s3 cp myDir s3://mybucket/ --recursive --exclude "*.jpg"
xxxxxxxxxx
# Single File. --grants flag is optional
aws s3 cp file.txt s3://my-bucket/ --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers full=emailaddress=user@example.com
# Multiple Files from directory. --grants flag is optional
aws s3 cp <your directory path> s3://<your bucket name> --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --recursive
# setting exclude or include flags
aws s3 cp <your directory path> s3://<your bucket name>/ --recursive --exclude "*.jpg" --include "*.log"
xxxxxxxxxx
aws s3 sync s3://bucketname/folder/ c:\localcopy
aws s3 sync s3://bucketname/folder/ c:\localcopy --delete