📁 File Management 📖 Official

Folder Sync and Comparison

Sync files between folders, compare differences, and keep content consistent

★★☆ Intermediate 10-15 min January 12, 2025
📋

Scenario

💬

Prompt

Please compare the differences between these two folders:
- Source: ~/Documents/Projects
- Target: /Volumes/USB/Projects
Show:
- Files that only exist in the source folder
- Files that only exist in the target folder
- Files that exist in both but have different content (determined by modification time or checksum)
- Summary of total count and total size

Then execute one-way sync:
- From ~/Documents/Projects to /Volumes/USB/Projects
- Only copy new and updated files
- Keep extra files in the target folder (don't delete)
- Show sync progress and completed file count
- Log sync activity to ~/sync_log.txt

Expected Result

💡

Tips

  • Using rsync's -avh parameters shows detailed progress. Adding --exclude can exclude files that don't need syncing, like .DS_Store, node_modules, etc.