Usage of --exclude for 6 folders

Hello, I'm trying to copy the content of a folder while excluded 6 subfolder and a file (vw-data/icon_cache /ssl /caddy-* last_backup.txt).
I've tryied multiple formating but nothing works. I got either a error saying : Command copy needs 2 arguments maximum: you provided 4 non flag arguments or nothing is exclude.

I'm using this version :
'''rclone v1.63.1

  • os/version: ubuntu 23.04 (64 bit)
  • os/kernel: 6.2.0-1011-raspi (aarch64)
  • os/type: linux
  • os/arch: arm64 (ARMv8 compatible)
  • go/version: go1.20.6
  • go/linking: static
  • go/tags: none'''

I'm using Google drive in shared drive

Here are somes of my attemps :

rclone copy -v --exclude vw-data/icon_cache** /ssl** /caddy-** last_backup.txt /home/dlabs/docker/vaultwarden/ gd:20-BACKUPS/vaultwarden/test

rclone copy -v --exclude="vw-data/icon_cache** /ssl** /caddy-** last_backup.txt" /home/dlabs/docker/vaultwarden/ gd:20-BACKUPS/vaultwarden/test

rclone copy -v --exclude="vw-data/icon_cache /ssl /caddy-** last_backup.txt"  /home/dlabs/docker/vaultwarden/ gd:20-BACKUPS/vaultwarden/test
rclone copy -v --exclude vw-data/icon_cache /ssl /caddy-** last_backup.txt  /home/dlabs/docker/vaultwarden/ gd:20-BACKUPS/vaultwarden/test
rclone copy -v --exclude icon_cache** --exclude ssl** --exclude caddy-** last_backup.txt /home/dlabs/docker/vaultwarden/ gd:20-BACKUPS/vaultwarden/test
rclone copy -v --exclude icon_cache** --exclude ssl --exclude caddy-** last_backup.txt /home/dlabs/docker/vaultwarden/ gd:20-BACKUPS/vaultwarden/test

A log from the command that you were trying to run with the -vv flag

[1] 850605
2023/09/14 12:35:49 DEBUG : rclone: Version "v1.63.1" starting with parameters ["rclone" "copy" "-vv" "--exclude" "icon_cache**"]
  rclone copy source:path dest:path [flags]

      --create-empty-src-dirs   Create empty source dirs on destination after copy
  -h, --help                    help for copy

Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.
Command copy needs 2 arguments minimum: you provided 0 non flag arguments: []
Command 'ssl' not found, did you mean:
  command 'sl' from deb sl (5.02-1)
  command 'sslh' from deb libnet-proxy-perl (0.12-6.2)
  command 'sslh' from deb sslh (1.20-1)
  command 'wsl' from deb wsl (0.2.1-3)
  command 'ss' from deb iproute2 (6.1.0-1ubuntu2)
  command 'sql' from deb parallel (20221122+ds-2)
  command 'ssh' from deb openssh-client (1:9.0p1-1ubuntu8.4)
  command 'stl' from deb numpy-stl (2.9.0-2build2)
  command 'ssr' from deb soundscaperenderer-common (0.6.0+dfsg2-1)
  command 'gsl' from deb generator-scripting-language (4.1.5-3)
  command 'ssu' from deb unifrac-tools (1.2-2)
  command 'sol' from deb aisleriot (1:3.22.23-1)
  command 'psl' from deb psl (0.21.2-1)
  command 'ss2' from deb python3-pyroute2 (0.7.2-2)
Try: sudo apt install <deb name>
[1]+  Exit 1                  rclone copy -vv --exclude icon_cache**

Thanks in advance for your answer

Exclude flag takes one argument only so in your case it should be:

--exclude vw-data/icon_cache/** --exclude /caddy-*/** --exclude /vw-data/icon_cache/**

When there are multiple items to exclude/include the best approach is to use filter. Create file filter.txt with below content:

- /ssl/**
- /caddy-*/**
- /vw-data/icon_cache/**

and then use it in your command:

--filter-from filter.txt

Thanks for you (really) fast answer.
I should have take more consideration into
--filter-from filter.txt

Now my filter are not consider. I try running the following command :
rclone copy /home/dlabs/docker/vaultwarden/ gd:20-BACKUPS/vaultwarden/test -v --exclude-from /home/dlabs/backup-jobs/filter.txt
rclone copy /home/dlabs/docker/vaultwarden/ gd:20-BACKUPS/vaultwarden/test -v --exclude-from filter.txt

I tried different content for my filter.txt :

- /caddy-config/
- /caddy-data/
- /caddy-site/
- /ssl/
- /vw-data/icon_cache/
- last_backup.txt


- /caddy-config/*
- /caddy-data/*
- /caddy-site/*
- /ssl/*
- /vw-data/icon_cache/*
- last_backup.txt


- /caddy-config
- /caddy-data
- /caddy-site
- /ssl
- /vw-data/icon_cache
- last_backup.txt

Why don't you follow example I gave you? Your random changes make things break:)

exclude-from and filter-from files have different formats. All details in documentation.


--filter-from filter.txt

and file:

- /caddy-config/**
- /caddy-data/**
- /caddy-site/**
- /ssl/**
- /vw-data/icon_cache/**
- last_backup.txt

It assumes that e.g. your ssl directory is in


If you still have problem run:

rclone copy [your flags] --dump filters

and post output here

Thanks for the documentation about the filtering, I completely forgot to look at her ..
You assume right about the directory.

After few tries to understand myself why the filter wasn't working, I figured out my last issue was I was using exclude-from instead of filter-from ...
Now it's working.

I'm not usually this type of user, but it look like I'm tired ..

Thanks for your help and your patience !

1 Like

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