Wrong Exit code

What is the problem you are having with rclone?

As per documentation ( https://rclone.org/docs/#list-of-exit-codes ) exite codes are:

  • 0 - success
  • 9 - Operation successful, but no files transferred

Using copy command i had '0' instead of '9'

What is your rclone version (output from rclone version)

rclone v1.53.3

  • os/arch: windows/amd64
  • go version: go1.15.5

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

windows 10 pro 64 bit

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

SFTP

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

rclone copy --progress --exclude /xxxxx/ Source:/home/user/path Locale:c:\local\dir

This is what i see (from --progress) and in destination folder i don't have files because on sftp server there are no files:

Transferred: 0 / 0 Bytes, -, 0 Bytes/s, ETA -
Elapsed time: 0.6s

Exit code returned is 0 not 9
I'm processing in a batch file and i need to do action only if files are downloaded.

Thanks in advance and excuse my english.

1 Like

Can you please include a full debug log of the issue?

before trying to copy, make sure that rclone can see the files in the remote.
test with rclone ls Source:/home/user/path -vv and post the output

Sorry but i'm at home now, i'll post the log next monday.

@asdffdsa rclone can read and copy, already tested that; if i don't use --exclude i can see and copy subfolders.

ok. but you wrote on sftp server there are no files:
so the actual problem is using --exclude?

need to see the exact command with a debug log

The problem is that on the server there are no files, only one subfolder (--exclude) and rclone exit code is 0 insteadof 9.
I'm testing cases that will occour in our work:

  • copy files (successful) and after launch another script (exit code 0)
  • no files to copy for any error and send an alert (exit code 1 - 8)
  • no files to copy because there are no files and do nothing (exit code 9)
    I will send log next working day

you might need to use this
https://rclone.org/docs/#error-on-no-transfer

1 Like

Thanks, i didn't see that flag.
So i have to treat this as an error .
Problem solved (I hope, monday i'll try)

Yes, normally copying no files isn't a problem.

hi, do you think that the docs need a tweak?

to append this

NB: Requires https://rclone.org/docs/#error-on-no-transfer 

@ncw yes and in mi case isn't a problem, but if i copy files i have to do things on them.

@asdffdsa i think it will be better with that tweak, i found the correct error code (9) for my needs but not that i had to use the flag "--error-on-no-transfer", because no files to copy isn't a error

Thanks to all.

That sounds like a good idea - want to send a fix?

wanted to check with you first.
yes, i will do that.

Thanks to all, problem solved.

please remind me
do i just raise the issue
or
do a pull request, with the change itself and the post that into a new issue?

For a small docs tweak, just send the PR, no issue needed.

hello and welcome to the forum,

glad that helped you.

and thanks to you, to remind me, that i need to submit a PR about this!

1 Like

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