aws / aws/aws-cli

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

Open
#9,841 3 comments 0 reactions 0 assignees View on GitHub
bug p3 s3
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.