I see from this post a few years ago named "how-to-quickly-know-if-a-remote-path-is-a-file-or-directory" (I can't post the link) that this question was asked and a response was provided that seems the output is for human review on a one by one basis.
I am curious if
since then there have been any newly available ways to handle this
there a way to make this determination more succinctly (i.e. perhaps a command that returns boolean response if it is a file or dir or a command that returns "dir" or "file") so a script that is reading a config file for paths to "rclone copy" can choose to do something different if it can determine that the remote path is a dir vs a file ahead of time?
Returning to update my previous answer with a bash function that checks if the path is a "file" or a "directory" using json, which also reports if the path is "not found" and if it is a "container/bucket dir" as well.
This requires you have jq installed (ex: apt-get install jq or brew install jq or ...)
Above seems to work albeit with minimal testing. If anyone has any suggested improvements that would be great. One improvement could be if only one call to the remote was needed instead of 2 to make this determination.
It seems that all of this would be better handled in the compiled rclone code instead of needing to do this in the script calling rclone. Then it could be a command rclone makes available to the script.
Interesting... not sure what that rc command and options you list out is supposed to be doing really but I did just try it and I noticed that it returns the same result for an empty but existing dir as for a non-existent path and the same for a container/bucket dir. Basically all 3 cases return a json with a "list" key that is an empty array.
I like your idea of a rclone stat or a --stat flag. It would be great if when called on any path, it would report on whether it is a file, a dir, a container/bucket dir, or non-existent path.
Perhaps a rclone exists would be useful as well that could really just internally call rclone stat and determine if the path exists or not.