Rclone backend/command cannot find command

What is the problem you are having with rclone?

I am trying to use the rc backend/command endpoint with the moveto command. However whatever I do it will not work and get the error command ... failed: command not found. Even when using the noop command it returns an error. I have tested moveto seperately without rc, then it works fine.

What is your rclone version (output from rclone version)

rclone v1.56.2

  • os/version: ubuntu 20.04 (64 bit)
  • os/kernel: 5.10.28-Unraid (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.16.8
  • go/linking: static
  • go/tags: none

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

gdrive with crypt

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

rclone rc backend/command command=moveto fs=gdrive-crypt-media: -a /intro/test123 -a /intro/test567

A log from the command with the -vv flag

2021/11/04 23:36:44 ERROR : rc: "backend/command": error: command "moveto" failed: command not found
2021/11/04 23:40:35 ERROR : rc: "backend/command": error: command "noop" failed: command not found
2021/11/04 23:48:35 ERROR : rc: "backend": error: couldn't find method "backend"
2021/11/04 23:48:55 ERROR : rc: "backend/command": error: command "moveto" failed: command not found
2021/11/04 23:49:06 ERROR : rc: "backend/command": error: command "moveto" failed: command not found

Backend commands are specific to remotes.

rclone backend help gdrive-crypt-media:

Would list out all the specific backend commands available for that remote.

I think you want:

https://rclone.org/rc/#operations-movefile

I have already used movefile - to transfer a file - but now I need to move a folder so it can be renamed. I am sorry I did not put this in my original post, I should have added that.

Currently to move a folder I use three API calls. I am creating a web interface and thus these commands are automatically executed in order after the previous command finished.

  • /operations/mkdir (making the new empty dir in case the folder that we want to rename is empty)
  • /sync/move (move the contents to the new folder)
  • /operations/purge (delete the old folder)

I would like to use async and have this all in one command. I can't add async now because of the purge at the end.

Do you still have a question then?

Yes definitely, if I can't do this with async I can not and will not implement the rename feature.

Running the command rclone backend help gdrive-crypt-media: gives the encrypt and decrypt commands. Which are mostly useless unless you want to modify files through the unencrypted fs of course.

Running rclone backend features gdrive-crypt-media: gives me the following result:

{
        "Name": "gdrive-crypt-media",
        "Root": "",
        "String": "Encrypted drive 'gdrive-crypt-media:'",
        "Precision": 1000000,
        "Hashes": [],
        "Features": {
                "About": true,
                "BucketBased": false,
                "BucketBasedRootOK": false,
                "CanHaveEmptyDirectories": true,
                "CaseInsensitive": false,
                "ChangeNotify": true,
                "CleanUp": true,
                "Command": true,
                "Copy": true,
                "DirCacheFlush": true,
                "DirMove": true,
                "Disconnect": false,
                "DuplicateFiles": true,
                "GetTier": false,
                "IsLocal": false,
                "ListR": true,
                "MergeDirs": true,
                "Move": true,
                "OpenWriterAt": false,
                "PublicLink": true,
                "Purge": true,
                "PutStream": true,
                "PutUnchecked": true,
                "ReadMimeType": false,
                "ServerSideAcrossConfigs": false,
                "SetTier": false,
                "SetWrapper": true,
                "Shutdown": false,
                "SlowHash": false,
                "SlowModTime": false,
                "UnWrap": true,
                "UserInfo": false,
                "WrapFs": true,
                "WriteMimeType": false
        }
}

Which states it has support for DirMove (and ChangeNotify, I would be really interested in that one but that's of topic).

Coming back to my question how can I rename a dir using one rc command? It needs to be possible to use with async.

Using sync/move is the way

https://rclone.org/rc/#sync-move

This will use a server side rename if possible.

I tried that before, and actually changed my code this afternoon to only use sync/move when the directory is not empty. When I tested it this afternoon it would keep the source directory but move the files.

I just restarted my rc server to enable verbose logging, and hopefully find out why the source directory would not be deleted. But now it does remove the source directory.

If it does not come up any more I will close this thread, thanks for the help!

The answer is in the docs...

This takes the following parameters:

  • srcFs - a remote name string e.g. "drive:src" for the source
  • dstFs - a remote name string e.g. "drive:dst" for the destination
  • createEmptySrcDirs - create empty src directories on destination if set
  • deleteEmptySrcDirs - delete empty src directories if set

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