Paths and Remote Syntax
Rclone targets are either local filesystem paths or remote paths using remote:path syntax.
Learning Focus
Most destructive incidents come from targeting the wrong destination. This lesson gives you a checklist to prove your SRC/DST are correct.
Syntax Rules
| Pattern | Meaning | Example |
|---|---|---|
/local/path | Local source or destination | /srv/uploads |
remote: | Remote root | s3-prod: |
remote:path/to/dir | Remote subpath | s3-prod:site/uploads |
:s3,env_auth:true:bucket/path | Backend-on-the-fly | :s3,provider=AWS:my-bucket/app |
Examples
# local -> remote
rclone copy /srv/data s3-prod:backup/data
# remote -> local
rclone copy s3-prod:backup/data /restore/data
# remote -> remote
rclone sync b2-prod:daily r2-prod:daily
A Safe Targeting Checklist
Before any sync:
- Confirm the source directory is mounted and non-empty.
- Confirm the destination prefix is the intended one.
- Do a
--dry-run -vvand scan the planned delete list.
targeting-checks.sh
test -d /srv/data || exit 1
test "$(ls -A /srv/data | wc -l)" -gt 0 || exit 1
rclone lsd s3-prod:backup >/dev/null
rclone sync /srv/data s3-prod:backup/data --dry-run -vv
tip
Use explicit paths instead of remote roots in production jobs. remote: is easy to mistarget.
Quoting and Spaces
rclone copy "/srv/notion-export/rsync markdown" "s3-prod:knowledge/rsync markdown"
note
If you can avoid spaces in destination prefixes, do it. It reduces quoting mistakes in automation.
Verification Pattern
# inspect destination before transfer
rclone lsd s3-prod:backup
# inspect result after transfer
rclone tree s3-prod:backup/data --max-depth 2
Common Targeting Mistakes
| Mistake | What it looks like | Safer alternative |
|---|---|---|
| Sync to remote root | remote-prod: | Use remote-prod:backups/app/current |
| Mixed environment remotes | prod source to staging destination | Use explicit env names in remote |
| Relative local paths in cron | ./data | Use absolute paths (/srv/data) |
Common Pitfalls
| Pitfall | Symptom | Fix |
|---|---|---|
| Missing remote prefix | Command runs locally by mistake | Use remote:path explicitly |
| Wrong bucket path | Files end up in root | Set and test exact destination path |
| Spaces not quoted | Path splitting errors | Always quote paths with spaces |