aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

aws s3 cp --recursive returns success when prefix (dir) doesn't exist

Open bgdnlp opened this issue 1 month ago • 1 comments

Describe the bug

aws s3 cp s3://my-bucket/no/such/directory/ --recursive

will always exit with error code 0 (success).

I'm not entirely sure if this should be considered a bug, but it was a surprise for me. Version

Regression Issue

  • [ ] Select this option if this issue appears to be a regression.

Expected Behavior

aws s3 cp will return 1 if the object doesn't exist. I expected --recursive to do the same.

aws s3 ls --recursive will also return 1 on a prefix that doesn't exist.

Current Behavior

returns 0 instead of 1

Reproduction Steps

aws --profile dprod s3 cp s3://noaa-goes16/ABI-L1b-RadC/2020/no/suc/dir/ . --recursive ; echo $?

Possible Solution

No response

Additional Information/Context

This is part of a script that was supposed to fail if it couldn't download a file. Can be worked around by running aws s3 ls first, but that's a reason to consider it a bug maybe?

CLI version used

2.28.24

Environment details (OS name and version, etc.)

Mac/Linux

bgdnlp avatar Nov 10 '25 13:11 bgdnlp