RC command for excluding a folder

What is the problem you are having with rclone?

Unable to exclude folder from a rc job. Have read forums for hours but none of the solutions appear to work.

I want to sync/copy the entire structure of the /data folder except the rClone folder (which is /data/rClone).

What is your rclone version (output from rclone version)


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

Google Drive

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

rclone rc sync/copy srcFs="freenas:/data" exclude="rClone/**" dstFs="GoogleDrive_NAS_crypt:NAS" --rc-addr= --rc-user=user --rc-pass=rclone _async=true -vv --checksum --transfers=1 --checkers=4 --contimeout=60s --timeout=300s --retries=3 --low-level-retries=10 --stats=1s --stats-file-name-length=0 --fast-list

perhaps that should be

can be easier to test filter using rclone ls, get that working, then try more complex commands.

and if that does not work, post a debug log.

Thanks, I have tried both with -- and without. Doesn't make a difference.

Seems _filter is the solution. No experience with it myself, but see this:

Thanks, still not having any luck with this:

rclone rc sync/copy srcFs="freenas:/data" _filter='{"ExcludeRule":"rClone/**"}' dstFs="GoogleDrive_NAS_crypt:NAS" --rc-addr= --rc-user=user --rc-pass=rclone _async=true -vv --checksum --transfers=1 --checkers=4 --contimeout=60s --timeout=300s --retries=3 --low-level-retries=10 --stats=1s --stats-file-name-length=0 --fast-list

I receive the following:

        "error": "key \"_filter\": invalid character '\\'' looking for beginning of value",
        "input": {
                "_async": "true",
                "_filter": "'{ExcludeRule:rClone/**}'",
                "dstFs": "GoogleDrive_NAS_crypt:NAS",
                "srcFs": "freenas:/data"
        "path": "sync/copy",
        "status": 400
type or paste code here

I also have limited experience with rc, but perhaps one of these works:


I remember something about using --loopback to test an rc command for syntax errors. Did you try that?

Thanks, will try.

@ncw any ideas?

Testing rclone rc operations/list ..., I get filtering to work with something like this:


That is:

  • The value of _filter is json string.
  • Key and value within the json must be properly quoted, escaped as necessary. The exact method may depend on your OS/shell.
  • The rule value is a list, i.e. in [ ] brackets

Which OS and shell are you using?

I ran it from powershell in win10

Then something like this should work (wrapping everything in single quotes to avoid PowerShell mangle with it, and then backslash-escape double quotes in the json value for the double quotes not to be "eaten" before rclone rc receives them):


Transferred to your command (untested):

rclone rc sync/copy srcFs="freenas:/data" dstFs="GoogleDrive_NAS_crypt:NAS" --rc-addr= --rc-user=user --rc-pass=rclone _async=true -vv --checksum --transfers=1 --checkers=4 --contimeout=60s --timeout=300s --retries=3 --low-level-retries=10 --stats=1s --stats-file-name-length=0 --fast-list '_filter={\"ExcludeRule\":[\"rClone/**\"]}'

Thanks so much, I can confirm that this works. I hope this helps others as the syntax in the documentation is confusing for something that I assume is quite a common request (albeit perhaps I'm just a noob :slight_smile: )

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