An rsync filter that is too broad can skip files that should be copied or transfer caches, logs, and temporary files that should stay local. Exclude rules let rsync build a smaller file list before the transfer starts, and a dry run shows the exact paths that would still move.
Rsync applies include and exclude rules in order while it scans the source tree. A directory pattern such as cache/ prevents traversal into that directory, while a filename pattern such as *.tmp matches temporary files at the scanned levels. Repeat --exclude for short rule lists, or move longer rule sets into --exclude-from so the command stays readable.
The examples below use a local project/ source tree and a backup/ destination so the filter effect is visible before any files are copied. Keep the trailing slash on project/ when the destination should receive the source directory contents, and review delete behavior separately because excluded files are normally protected from --delete unless --delete-excluded is used.

$ rsync -a --dry-run --itemize-changes --exclude='cache/' --exclude='*.tmp' project/ backup/ created directory backup cd+++++++++ ./ >f+++++++++ README.md cd+++++++++ logs/ >f+++++++++ logs/app.log cd+++++++++ reports/ >f+++++++++ reports/summary.txt cd+++++++++ src/ >f+++++++++ src/app.py
The output includes reports/summary.txt and src/app.py, but it does not include cache/ or reports/draft.tmp.
$ rsync -a --dry-run --itemize-changes --include='reports/***' --exclude='*' project/ backup/ created directory backup cd+++++++++ ./ cd+++++++++ reports/ >f+++++++++ reports/draft.tmp >f+++++++++ reports/summary.txt
Rsync stops at the first matching filter rule, so the include rule must appear before the final --exclude='*' rule.
cache/ *.tmp
Blank lines and whole-line comments starting with # are ignored in --exclude-from files.
$ rsync -a --dry-run --itemize-changes --exclude-from=exclude-rules.txt project/ backup/ created directory backup cd+++++++++ ./ >f+++++++++ README.md cd+++++++++ logs/ >f+++++++++ logs/app.log cd+++++++++ reports/ >f+++++++++ reports/summary.txt cd+++++++++ src/ >f+++++++++ src/app.py
Use How to debug rsync filter rules when a rule does not match the path you expected.
README.md reports/summary.txt src/app.py
--files-from is an allow-list. Each entry is relative to the source path, and rsync preserves the listed path structure by default.
$ rsync -a --dry-run --itemize-changes --files-from=rsync-files.txt project/ backup/ created directory backup >f+++++++++ README.md cd+++++++++ reports/ >f+++++++++ reports/summary.txt cd+++++++++ src/ >f+++++++++ src/app.py
When a mirror command also uses --delete, review delete behavior with the same filter rules before running it against an important destination.