Skip to main content

rclone --include

The include flag switches rclone into allow-list behavior, where only intended paths are eligible for transfer. This guide helps you build strict include rules that reduce data sprawl, improve runtime performance, and make backup outcomes easier to reason about.

Syntax

rclone copy SRC DST --include "PATTERN"

Common Patterns

# copy only markdown docs
rclone copy /srv/docs remote:backup/docs --include "**/*.md" --include "**/*.mdx"

# copy only sql backups
rclone copy /srv/backups remote:archive/db --include "**/*.sql.gz"

Notes

  • When using include rules, think in allow-list mode.
  • Add multiple --include flags for multiple file types.
  • Validate selected files with dry-run.
rclone copy /srv/docs remote:backup/docs --include "**/*.md" --dry-run -vv

Examples with Output

1. Include only markdown

Input command:

rclone copy /srv/docs remote:backup/docs --include "**/*.md" --dry-run

Expected output:

NOTICE: only *.md selected
Would transfer 37 files

2. Include md and mdx

Input command:

rclone copy /srv/docs remote:backup/docs --include "**/*.md" --include "**/*.mdx" --dry-run

Expected output:

NOTICE: include rules matched docs only
Would transfer 58 files

3. Include SQL archives

Input command:

rclone copy /srv/backups remote:archive/db --include "**/*.sql.gz" --dry-run

Expected output:

NOTICE: only *.sql.gz selected
Would transfer 12 files

4. Include JSON configs

Input command:

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

Expected output:

NOTICE: only JSON files included
Would transfer 44 files

5. Include wp-content uploads

Input command:

rclone copy /srv/www remote:backup/www --include "wp-content/uploads/**" --dry-run

Expected output:

NOTICE: uploads path included
Would transfer 216 files

6. Include certificate files

Input command:

rclone copy /etc/ssl remote:backup/ssl --include "**/*.crt" --include "**/*.key" --dry-run

Expected output:

NOTICE: cert/key allow-list active
Would transfer 8 files

7. Include only CSV exports

Input command:

rclone copy /srv/reports remote:backup/reports --include "**/*.csv" --dry-run

Expected output:

NOTICE: only CSV files selected
Would transfer 25 files

8. Include image assets

Input command:

rclone copy /srv/site remote:backup/site --include "**/*.{png,jpg,webp}" --dry-run

Expected output:

NOTICE: image file set selected
Would transfer 193 files

9. Include top-level env template

Input command:

rclone copy /srv/app remote:backup/app --include "/.env.example" --dry-run

Expected output:

NOTICE: /.env.example included
Would transfer 1 files

10. Include PHP and Twig only

Input command:

rclone copy /srv/app remote:backup/app --include "**/*.php" --include "**/*.twig" --dry-run

Expected output:

NOTICE: backend templates selected
Would transfer 71 files

11. Include date-stamped logs

Input command:

rclone copy /srv/logs remote:archive/logs --include "**/2026-02-*.log" --dry-run

Expected output:

NOTICE: February logs selected
Would transfer 17 files

12. Include Terraform files

Input command:

rclone copy /srv/iac remote:backup/iac --include "**/*.tf" --include "**/*.tfvars" --dry-run

Expected output:

NOTICE: Terraform files selected
Would transfer 29 files

13. Include only checksums

Input command:

rclone copy /srv/release remote:backup/release --include "**/*.sha256" --dry-run

Expected output:

NOTICE: checksum files selected
Would transfer 6 files

14. Include with verbose check

Input command:

rclone copy /srv/docs remote:backup/docs --include "**/*.mdx" --dry-run -vv

Expected output:

DEBUG: Included by rule: guide/setup.mdx
INFO : 1 include rules active

15. Multiple include rules

Input command:

rclone copy /srv/app remote:backup/app --include "**/*.yml" --include "**/*.yaml" --include "**/*.json" --dry-run

Expected output:

NOTICE: 3 include rules applied
Would transfer 54 files