← 返回
效率工具 中文

Sync Backup

Synchronize files and directories between local, remote, and cloud storage reliably.
在本地、远程和云存储之间可靠地同步文件和目录。
macdesire
效率工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 594
下载
💾 3
安装
1
版本
#latest

概述

File Synchronization Rules

rsync Fundamentals

  • Trailing slash matters: rsync src/ copies contents, rsync src copies the folder itself — this is the #1 cause of wrong directory structures
  • Always use -avz baseline: archive mode preserves permissions/timestamps, verbose shows progress, compress speeds transfers
  • Add --delete only when you want destination to mirror source exactly — without it, deleted source files remain on destination
  • Use --dry-run before any destructive sync — shows what would change without modifying anything

Exclusions

  • Create an exclude file instead of multiple --exclude flags: rsync -avz --exclude-from=.syncignore src/ dest/
  • Standard excludes for code projects: .git/, node_modules/, __pycache__/, .venv/, *.pyc, .DS_Store, Thumbs.db
  • Exclude patterns are relative to source root — /logs/ excludes only top-level logs, logs/ excludes logs/ anywhere

Cloud Storage (rclone)

  • rclone sync deletes destination files not in source; rclone copy only adds — use copy when unsure
  • Configure remotes interactively: rclone config — never hardcode cloud credentials in scripts
  • Test with --dry-run first, then --progress for visual feedback during actual sync
  • For S3-compatible storage, set --s3-chunk-size 64M for large files to avoid timeouts

Verification

  • After critical syncs, verify with checksums: rsync -avzc uses checksums instead of size/time (slower but certain)
  • For rclone, use rclone check source: dest: to compare without transferring
  • Log sync operations to file for audit: rsync -avz src/ dest/ | tee sync.log

Bidirectional Sync

  • rsync is one-way only — for true bidirectional sync, use unison: unison dir1 dir2
  • Unison detects conflicts when both sides change — resolve manually or set prefer rules
  • Cloud services like Dropbox/Syncthing handle bidirectional automatically — don't reinvent with rsync

Remote Sync

  • For SSH remotes, use key-based auth: rsync -avz -e "ssh -i ~/.ssh/key" src/ user@host:dest/
  • Specify non-standard SSH port: -e "ssh -p 2222"
  • Use --partial --progress for large files over unreliable connections — allows resume on failure

Common Pitfalls

  • Syncing to mounted drives that unmount silently creates a local folder with the mount name — verify mount before sync
  • Running sync without --delete repeatedly causes destination to accumulate deleted files forever
  • Time-based sync fails across machines with clock skew — use --checksum for accuracy or sync NTP first

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 02:09 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Nano Pdf

steipete
使用nano-pdf CLI通过自然语言指令编辑PDF
★ 275 📥 114,962
productivity

Weather

steipete
获取当前天气和预报(无需API密钥)
★ 446 📥 226,456
productivity

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 440 📥 148,118