Skip to main content

rclone --exclude

The exclude flag is the fastest way to remove noisy, risky, or irrelevant paths from a transfer plan. This guide focuses on practical exclusion design so logs, caches, secrets, and generated artifacts are consistently skipped without accidentally filtering business-critical files.

Syntax

rclone copy SRC DST --exclude "PATTERN"

Common Patterns

# skip dependency trees
rclone sync /srv/app remote:backup/app --exclude "**/node_modules/**"

# skip logs
rclone sync /srv/app remote:backup/app --exclude "**/*.log"

# skip git metadata
rclone sync /srv/app remote:backup/app --exclude "**/.git/**"

Notes

  • Use quotes around patterns to avoid shell expansion.
  • ** is recursive and usually needed for nested paths.
  • Prefer dry-run before production changes.
rclone sync /srv/app remote:backup/app --exclude "**/*.tmp" --dry-run -vv

Examples with Output

1. Exclude log files

Input command:

rclone copy /srv/app remote:backup/app --exclude "**/*.log" --dry-run

Expected output:

NOTICE: *.log files skipped
Transferred: 0 / Queued files: 214

2. Exclude node_modules

Input command:

rclone sync /srv/app remote:backup/app --exclude "**/node_modules/**" --dry-run

Expected output:

NOTICE: node_modules trees excluded
Would transfer 128 files

3. Exclude .git metadata

Input command:

rclone copy /srv/app remote:backup/app --exclude "**/.git/**" --dry-run

Expected output:

NOTICE: .git content excluded
Would transfer repository working files only

4. Exclude env files

Input command:

rclone copy /srv/app remote:backup/app --exclude "**/.env*" --dry-run

Expected output:

NOTICE: .env and .env.* excluded
Would transfer 96 files

5. Exclude cache folders

Input command:

rclone sync /srv/app remote:backup/app --exclude "**/cache/**" --dry-run

Expected output:

NOTICE: cache directories excluded
Would transfer 73 files

6. Exclude temp files

Input command:

rclone copy /srv/app remote:backup/app --exclude "**/*.tmp" --dry-run

Expected output:

NOTICE: *.tmp excluded
Would transfer 151 files

7. Exclude uploads older dumps

Input command:

rclone copy /srv/uploads remote:backup/uploads --exclude "**/*.bak" --dry-run

Expected output:

NOTICE: backup suffix files excluded
Would transfer 410 files

8. Exclude hidden directories

Input command:

rclone copy /srv/app remote:backup/app --exclude "/.*" --dry-run

Expected output:

NOTICE: top-level hidden directories excluded
Would transfer 88 files

9. Exclude wordpress cache plugins

Input command:

rclone sync /srv/www remote:backup/www --exclude "**/wp-content/cache/**" --dry-run

Expected output:

NOTICE: wp-content/cache excluded
Would transfer 302 files

10. Exclude sqlite and lock files

Input command:

rclone copy /srv/data remote:backup/data --exclude "**/*.sqlite*" --exclude "**/*.lock" --dry-run

Expected output:

NOTICE: sqlite and lock files excluded
Would transfer 49 files

11. Exclude large media folder

Input command:

rclone copy /srv/app remote:backup/app --exclude "media/raw/**" --dry-run

Expected output:

NOTICE: media/raw excluded
Would transfer 67 files

12. Exclude build artifacts

Input command:

rclone sync /srv/repo remote:backup/repo --exclude "**/dist/**" --exclude "**/build/**" --dry-run

Expected output:

NOTICE: dist/build trees excluded
Would transfer 119 files

13. Exclude JSON logs recursively

Input command:

rclone copy /srv/app remote:backup/app --exclude "**/logs/**/*.json" --dry-run

Expected output:

NOTICE: nested JSON logs excluded
Would transfer 92 files

14. Exclude by suffix and verify

Input command:

rclone copy /srv/app remote:backup/app --exclude "**/*-debug.txt" --dry-run -vv

Expected output:

DEBUG: Excluded file: api-debug.txt
INFO : 1 files excluded by rule

15. Multiple exclude flags

Input command:

rclone sync /srv/app remote:backup/app --exclude "**/*.log" --exclude "**/*.tmp" --exclude "**/.env" --dry-run

Expected output:

NOTICE: 3 exclude rules applied
Would transfer 84 files