Copy a file or object

The Copy (cp) operation copies a local file or object to another location, locally, or in a system.

Note: The example assumes the sample and sample2 buckets exist.

Example: Copy (upload) a local file to the bucket

aws --endpoint-url=https://somename.example.com/ s3 cp someFile.txt s3://sample

Example: Copy an object within the same bucket

aws --endpoint-url=https://somename.example.com/ s3 cp s3://sample/someFile.txt s3://sample/someFileBackup.txt
Example: Copy an object between two buckets

aws --endpoint-url=https://somename.example.com/ s3 cp s3://sample/someFile.txt s3://sample2/someFile.txt
Example: Copy a series of buckets and objects recursively

aws --endpoint-url=https://somename.example.com/ s3 cp path s3://sample/path --recursive

Example: Copy a series of buckets and objects recursively

ws --endpoint-url=https://somename.example.com/ s3 cp path s3://sample/path --recursive

Example: Copy a series of buckets and objects recursively but exclude all files or 
objects that matches the specified pattern

aws --endpoint-url=https://somename.example.com/ s3 cp path s3://sample/path --recursive --exclude "*.txt"