I need to copy content inside a AWS S3 bucket root folder to another folder inside root.
I want copy all files in root (textfile1.txt etc) except other folders (folder1,folder2) in to the folder3.
What would be the aws s3 copy command for it?
/
folder1
folder2
textfile1.txt
textfile2.txt
--many other text files
folder3
Simpler Permission with Multiple Buckets If the images are used in different use cases, using multiple buckets will simplify the permissions model, since you can give clients/users bucket level permissions instead of directory level permissions.
When passed with the parameter --recursive the aws s3 cp command recursively copies all objects from source to destination. It can be used to download and upload large set of files from and to S3.
To upload folders and files to an S3 bucketSign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to upload your folders or files to. Choose Upload.
This command will copy all files from the root of the bucket, but will not copy any sub-folders:
aws s3 cp s3://my-bucket s3://my-bucket/destination --recursive --exclude "*/*"
--recursive
causes it to copy all files and folders--exclude "*/*"
prevents it from copying any objects with a /
in the key (which is used to indicate a sub-folder)See also:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With