Filtering: --filter-from: include all files but exclude all subdirs

rclone v1.48.0

  • os/arch: linux/386
  • go version: go1.12.6

Trying to create a job that copies a set of directories, but excludes some named subdirectories.

e.g. in the following, I want to copy all the files in /root/projects/dev/ but exclude all the subdirectories of /root/data/projects/dev/

In the case of e.g. /root/data/projects/stats/, that has bin/ and .git/ subdirs that I want to include in the copy, but also has a data/ subdirectory that I want exclude.

However, this filter file & rclone command appears to copy everything - at least if I run with the -n option for a dry run, it appears to do so.

How do I resolve this?

(annoyingly, I have had this running before but can't recall how or find the filter file I used)

rclone -vPL copy /root/projects/ googleDrive:archiv/src/ --filter-from=/root/data/projects/filterlist
- /root/data/projects/dev/trends/**
- /root/data/projects/dev/archive/**
- /root/data/projects/dev/json_files/**
- /root/data/projects/dev/pngs/**
- /root/data/projects/dev/diff/**
- /root/data/projects/dev/tls/**
- /root/data/projects/dev/xmls/**
- /root/data/projects/dev/fandf/**
- /root/data/projects/dev/toast/**
- /root/data/projects/dev/blox/**
- /root/data/projects/dev/uptidy/**
- /root/data/projects/dev/searches/**
- /root/data/projects/dev/analysis/**
- /root/data/projects/dev/21199/**
- /root/data/projects/wfh/data/**
- /root/data/projects/randomtopic/data/**
- /root/data/projects/stats/data/**
- /root/data/projects/gpx/data/**
- /root/data/projects/perform/data/**
- /root/data/projects/workdata/**
- /root/data/projects/archive_postprocess/data/**
- /root/data/projects/longitudinal/data/**
+ /root/data/projects/wfh/
+ /root/data/projects/randomtopic/
+ /root/data/projects/stats/
+ /root/data/projects/lib/
+ /root/data/projects/gpx/
+ /root/data/projects/performa/
+ /root/data/projects/credentials/
+ /root/data/projects/archive_postprocess/
+ /root/data/projects/longitudinal/
+ /root/data/projects/dev/

The filter should be relative from your starting point.

Is you starting point /root/projects and you want to filter stuff from that point on?

You can test with a rclone ls instead of running a copy as well.

1 Like


That gave me the hint I needed.

I do like the job that rclone does, but the way it handles full/relative paths confuses me every time.

Running from /root/projects, the command & arguments needed to be:

nohup rclone -vPL copy ./ googleDrive:archiv/src/ --filter-from=filterlist

while the filterlist needed to look like this:

- dev/trends/**
- dev/archive/**
- dev/json_files/**
- dev/pngs/**
- dev/diff/**
- dev/tls/**
- dev/xmls/**
- dev/fandf/**
- dev/toast/**
- dev/blox/**
- dev/uptidy/**
- dev/searches/**
- dev/analysis/**
- dev/21199/**
- wfh/data/**
- randomtopic/data/**
- stats/data/**
- gpx/data/**
- perform/data/**
- workdata/**
- archive_postprocess/data/**
- longitudinal/data/**
+ wfh/
+ randomtopic/
+ stats/
+ lib/
+ gpx/
+ performa/
+ credentials/
+ archive_postprocess/
+ longitudinal/
+ dev/

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