Exit code for missing source file (s3 to s3)

What is the problem you are having with rclone?

I'm doing an rclone s3 to s3 copy. The source file doesn't exist. The destination is a "directory". I expected the exit code to be 4 for "File not found" but it's 0.

What is your rclone version (output from rclone version)

rclone v1.48.0

  • os/arch: linux/amd64
  • go version: go1.12.6

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Linux 64 bit (CentOS 7.6.1810)

Which cloud storage system are you using? (eg Google Drive)

Scality (Amazon S3 compatible)

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone copy -v "one_bucket://bucket_name_1/path/to/file/exists/file_does_not_exist.jpg" "another_bucket://bucket_name_2/some/other/directory" ; echo $?

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

Transferred: 0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors: 0
Checks: 0 / 0, -
Transferred: 0 / 0, -
Elapsed time: 300ms

2019/08/26 17:00:36 DEBUG : 8 go routines active

I can provide more -vv context but I think that maybe the problem is me and some understanding not an rclone bug.

Thanks for your help!


Note that rclone copy has two forms, rclone copy file dir and rclone copy dir dir.

If you use a non existent file, then rclone will assume the latter form.

However due to this: https://github.com/rclone/rclone/issues/3453 it won't return an error.

Once we've fixed that then it will give an error ("directory not found") rather than exiting.

You can also use rclone copyto which does file->file or dir->dir but I think that will have the same problem.

There is an rc call which will copy a file and only a file

$ rclone rc --loopback operations/copyfile srcFs=/tmp srcRemote=zx dstFs=/tmp dstRemote=zz

which will give an error "object not found" if the source isn't found.

Probably what we need is to expose copyfile as a command.

Thank you ever so much for the detailed answer. I'm watching now https://github.com/rclone/rclone/issues/3453 since this would fix the problem (make sure that what I intended to copy has been copied :slight_smile: ). Having an explicit "copy file" might also be handy indeed.

(at work we recently moved to more object storage solutions and we are enjoying rclone very much, thanks for doing it!)


1 Like

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