Filter-from: exclude dir, include subdirs

What is the problem you are having with rclone?

I have the following lines in my filter file

- /AppData/
+ /AppData/MuseScore/
+ /AppData/tasknotes/
+ /AppData/Zotero/AUTH/

The idea is to skip syncing the AppData directory, while syncing some subdirectories.

Run the command 'rclone version' and share the full output of the command.

rclone v1.57.0
- os/version: arch rolling (64 bit)
- os/kernel: 5.16.4-arch1-1 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.5
- go/linking: dynamic
- go/tags: none

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

OneDrive for Business

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

rclone sync --copy-links -v polimi: /mnt/internal/SharedData/Public/onedrive/polimi_wsl/ --filter-from ~/.config/rclone/polimi_filters.txt```

The rclone config contents with secrets removed.

type = onedrive
region = global
token = *edited*
drive_id = *edited*
drive_type = business

A log from the command with the -vv flag

Not sure if it's useful, I guess is more me failing in understanding how filters work, but if it can be useful I will provide one.

The best way to test filters is just use rclone ls and make sure the output is displaying what you want before you do a sync and you can use --dry-run with the sync to validate things.

Filters-from is read from top down, and will match in order so if you exclude that first line, nothing after it will match. You want to setup the most restrictive rules first and work your way down the list.

Rclone Filtering

So flip it around to match the files:

+ /AppData/MuseScore/**
+ /AppData/tasknotes/**
+ /AppData/Zotero/AUTH/**
- /AppData/**

The ** will match all files and directories underneath it.

1 Like

Thank you @Animosity022 , that indeed solved my issue.
Just out of curiosity: is the dir/** mandatory? And if so, why should I use it instead of the plain dir/ or also dir?

Check out:

Rclone Filtering

As that explains it.

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