`rclone ls backend:file`: doesn't exit with a fail code when not existing

I'm trying understand if I'm not using the right command, but I was expecting rclone to exit with an error code != 0 when doing rclone ls backend:file over an inexisting file.

Current behaviour only exists with a 0 code, like nothing happened, which renders scripting or file checking kind of very inconvenient.

Any ideas if this is expected behaviour and what should I do to validate the existance of a file in the current design?

### List of exit codes

* `0` - success
* `1` - Syntax or usage error
* `2` - Error not otherwise categorised
* `3` - Directory not found
* `4` - File not found
* `5` - Temporary error (one that more retries might fix) (Retry errors)
* `6` - Less serious errors (like 461 errors from dropbox) (NoRetry errors)
* `7` - Fatal error (one that more retries won't fix, like account suspended) (Fatal errors)
* `8` - Transfer exceeded - limit set by --max-transfer reached
* `9` - Operation successful, but no files transferred

I have just tried and it exits with code 3 or 4.

$ rclone ls onedrive:NotExisting
$ echo $?

Could you please post replicable example with all details?

Uhm, maybe it's related only to S3 or S3 compatible backends?

╰─ rclone ls wasabi:{BUCKET}/this.does.not.exist$RANDOM; echo $?                                         

╰─ rclone ls backblaze:{BUCKET}/this.does.not.exist$RANDOM; echo $?                                             

1 Like

Now we are talking:

$ rclone ls s3:test-bucket-kptsky/BS
$ echo $?

OK, so this means there's a bug specific to the S3 backend plugin, right?

At least this is not nice behaviour. If path does not exist it should throw an error.

You can try to fix it and submit PR.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.