Exit codes of different copy/sync results?

Hi all,

Sorry if this has been asked before but again I searched the forum and found nothing close to what I want to know so I decided to just start a new topic.

Anyway, are there any exit codes about each copy/sync results other than just success or error?
I have checked this page and it only lists success and error codes for different reasons.
https://rclone.org/docs/#exit-code

I want to know about the success codes of results, for example:

  • files and folders copied - 10
  • files copied - 15
  • folders copied - 20
  • nothing copied, no changes - 25
  • nothing copied, extra files deleted - 30
    .....

In Windows, robocopy shows different exit codes for each copy results.
https://ss64.com/nt/robocopy-exit.html
Is there anything similar in rclone?
Thanks!

I believe the exit codes you linked are accurate across the board.
Meaning - there isn't really any exit-code distinction between one type of success and another.

I think it is very standard to have 0 be defined a success (generally, as in no error occurred), and it sound like if you messed with that standard it might break interoperability with other programs that might start freaking out if they see anything other than a 0...
I am by no means an authority on this, but I suspect that (interoperability) is why such a pattern is followed even if I agree the added feedback could be very useful.

There may be some other way to transfer this information though. One thing that immediately comes to mind is that the rclone process could spit out a code to the RC (remote control) server which you could then read out easily to decide the next appropriate action in your script. There may even be something like this already - check the RC docs. If not then a hook would need to be added to the code and a function to read out the latest exist-status, but that's not something that would be too hard I think.

Actually, I don't really need the exit codes for those results. I just listed them in case someone else have the same question/thought.
The only thing I want to know is if there is any way in rclone to return a signal or line that nothing was copied after the command completed?
I need to use that line/code to break my rclone script so that it will stop running after X runs without anything copied or deleted.

Or is my only option to write to the logs and grep that line out?

Is there any problem with using the exit code of 0? It indicates that the sync completed successfully without any errors.

Nothing wrong with it, I just want an exit code of "nothing was copied" to break my script.
Any other suggestions are welcomed.

Doesn't a complete sync indicate that too? Or do you explicitly want a status code for "nothing was copied" and not that the sync is complete after copying a few files?

I could see it being conditionally useful - such as in the example of "nothing was copied" in a long chain of commands. Then your code might decide that if the first step was "nothing" then all the subsequent steps can also be skipped.

But usually there are other ways around it. For example you might just "ls" the location first - check if there are 0 lines in the return, and if so - make a choice in the script based on that.

If the OP has some spesific scenario he would like ideas for I'm sure there are alternative ways of accomplishing the goal - but I see where he is coming from with this.

Yes, exactly what I want.

Your best bet would be to use a rc command and check its status for the number of files transferred. Documentation is available at https://rclone.org/rc/