Home > OS >  aws s3 sync behavior different than linux cp and rsync when copying folders and their contents
aws s3 sync behavior different than linux cp and rsync when copying folders and their contents

Time:11-10

Am I missing something here?

On Linux

cp -r ./test1/ test2/

results in test1/ INSIDE of test2/

rsync -r ./test1/ test2/

results in test1/ INSIDE of test2/

rsync -r ./test1 test2/

results in CONTENTS of test1/ inside of test2/`

With aws s3 sync

aws s3 sync ./test1/ s3://mybucket/

results in the CONTENTS of test1/ in s3://mybucket/ instead of the test1/ folder INSIDE the s3 bucket like s3://mybucket/test1/CONTENTS.

Is this on purpose? Is there anyway to force the interaction to be the same?

CodePudding user response:

You could use:

aws s3 sync ./test1/ s3://mybucket/test1/

Or, you can sync the current folder, but specify which paths to include:

aws s3 sync . s3://mybucket/ --exclude "*" --include "test1/*"

See: AWS CLI: Use of Exclude and Include filters

  • Related