📁 ファイル管理 📖 公式

フォルダの同期と比較

フォルダ間でファイルを同期し、差分を比較してコンテンツの一貫性を保ちます

★★☆ 中級 10-15 min 2025年1月12日
📋

シナリオ

💬

プロンプト

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

期待される結果

💡

ヒント

  • rsyncの -avh パラメータを使用すると詳細な進捗が表示されます。--exclude を追加すると、同期不要なファイル(.DS_Store、node_modulesなど)を除外できます。