brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: rclone can read include and exclude rules from one filter file

Rclone
~/tips/tip-rclone-filter-from-file

- *.tmp

Keeps your skip rules in a readable file you can test first.

A command line with eight --exclude flags is hard to read and harder to trust. Put the rules in a file.

Each line starts with - to exclude or + to include:

# filters.txt
- *.tmp
- node_modules/**
- /Downloads/**
+ **

Then test it against a listing, which changes nothing:

rclone ls /home/user --filter-from filters.txt

What you see is what a copy or sync would handle. When the list looks right, use the same flag on the real command.

Order matters most. Rules are read from the top and the first match decides, so a specific exception has to come before the broad rule it escapes from. A path that matches nothing is included. A single * stays within one folder level, while ** crosses slashes, and a leading slash anchors a rule to the root of the path you gave.

If something is picked up that shouldn’t be, --dump filters shows how rclone turned your lines into patterns.

Comments go on their own lines. An inline comment after a rule is not supported and becomes part of the pattern. And remember that with sync, excluded files on the destination are left alone by default; --delete-excluded removes them, so I wouldn’t add that without a dry run.

Further reading: rclone filtering

Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more

More Rclone tips rclone copyurl https://example.com/files/big.iso remote:isos -a rclone size remote:photos rclone config redacted rclone ncdu remote:backup rclone copy /data remote:data --bwlimit "08:00,1M 18:00,5M 23:00,off" -P All Rclone tips (14) All topics

Link