Skip to main content

rclone --exclude-from

Exclude-from externalizes filtering logic into reusable rule files, which is essential for production-grade automation. This guide shows how to structure rule files for maintainability so teams can review, version, and safely evolve exclusion policies over time.

Syntax

rclone sync SRC DST --exclude-from /path/to/exclude.rules

Rule File Example

/etc/rclone/app.exclude
**/.git/**
**/node_modules/**
**/*.log
**/.env
rclone sync /srv/app remote:backup/app --exclude-from /etc/rclone/app.exclude

Notes

  • Keep one rule per line.
  • Store rule files in infra repos, not in ad-hoc shell history.
  • Re-test after every rule change.
rclone sync /srv/app remote:backup/app --exclude-from /etc/rclone/app.exclude --dry-run -vv

Examples with Output

1. Use exclude file for app backup

Input command:

rclone sync /srv/app remote:backup/app --exclude-from /etc/rclone/app.exclude --dry-run

Expected output:

NOTICE: loaded exclude rules from file
Would transfer 86 files

2. Exclude from custom path

Input command:

rclone copy /srv/docs remote:backup/docs --exclude-from /opt/rules/docs.exclude --dry-run

Expected output:

NOTICE: using /opt/rules/docs.exclude
Would transfer 45 files

3. Exclude from relative file

Input command:

rclone copy . remote:repo/snapshot --exclude-from ./rules/local.exclude --dry-run

Expected output:

NOTICE: local exclude file applied
Would transfer 63 files

4. Exclude secrets via rule file

Input command:

rclone sync /srv/app remote:backup/app --exclude-from /etc/rclone/secrets.exclude --dry-run

Expected output:

NOTICE: secrets patterns excluded
Would transfer 91 files

5. Combine exclude-from and dry-run verbose

Input command:

rclone copy /srv/app remote:backup/app --exclude-from /etc/rclone/app.exclude --dry-run -vv

Expected output:

DEBUG: Excluded by file rule: .env
INFO : 14 files excluded by rules

6. Exclude vendor and cache

Input command:

rclone sync /srv/www remote:backup/www --exclude-from /etc/rclone/wp.exclude --dry-run

Expected output:

NOTICE: vendor/cache rules loaded
Would transfer 233 files

7. Exclude from env-specific file

Input command:

rclone copy /srv/config remote:backup/config --exclude-from /etc/rclone/prod.exclude --dry-run

Expected output:

NOTICE: prod rule set active
Would transfer 22 files

8. Exclude-from with check

Input command:

rclone copy /srv/data remote:backup/data --exclude-from /etc/rclone/data.exclude --dry-run && rclone check /srv/data remote:backup/data --one-way

Expected output:

NOTICE: transfer preview completed
NOTICE: check completed without differences

9. Exclude old logs file list

Input command:

rclone copy /var/log remote:archive/log --exclude-from /etc/rclone/log.exclude --dry-run

Expected output:

NOTICE: old log rules applied
Would transfer 40 files

10. Exclude-from for media cleanup sync

Input command:

rclone sync /srv/media remote:backup/media --exclude-from /etc/rclone/media.exclude --dry-run

Expected output:

NOTICE: media exclude file loaded
Would transfer 310 files

11. Exclude-from for CI artifact publish

Input command:

rclone copy ./dist remote:releases/app --exclude-from .ci/release.exclude --dry-run

Expected output:

NOTICE: CI exclude rules active
Would transfer 18 files

12. Exclude-from for home backup

Input command:

rclone sync /home/ubuntu remote:backup/home --exclude-from /etc/rclone/home.exclude --dry-run

Expected output:

NOTICE: home exclusions loaded
Would transfer 512 files

13. Exclude-from with bandwidth limit

Input command:

rclone copy /srv/data remote:backup/data --exclude-from /etc/rclone/data.exclude --bwlimit 8M --dry-run

Expected output:

NOTICE: bwlimit set to 8M
Would transfer 74 files

14. Exclude-from with immutable copy

Input command:

rclone copy /srv/releases remote:archive/releases --exclude-from /etc/rclone/releases.exclude --immutable --dry-run

Expected output:

NOTICE: immutable mode active
Would transfer 27 files

15. Exclude-from + checksum

Input command:

rclone copy /srv/app remote:backup/app --exclude-from /etc/rclone/app.exclude --checksum --dry-run

Expected output:

NOTICE: checksum comparison enabled
Would transfer 39 files