Reputation: 3
I have multiple files in the s3 bucket which I am trying to move to a different bucket that matches the given prefixes.
File Names: test001, test002, test003, test004, example1, example2
I am using AWS cp command in the Bash Script to move files but it's not working for me.
aws s3 cp s3://example-1//test s3://example-2/test --recursive
Can you please tell me how can I move files from one bucket to another which matches the prefix?
Upvotes: 0
Views: 326
Reputation: 8022
Run this command (with your actual s3 source and destination endpoints) to copy the files with names that begin with "test"
and "example":
aws s3 cp s3://srcbucket/ s3://destbucket/ --recursive --exclude "*" --include "test*" --include "example*"
The --exclude
and --include
parameters are processed on the client side. Because of this, the resources of your local machine might affect the performance of the operation.
Upvotes: 1
Reputation: 46859
Try something like this:
aws s3 cp s3://example-1/ s3://example-2/ --include "test*" --recursive
Upvotes: 0