rsync が特定のファイルをコピーしている、またはコピーしていない理由を診断する

rsync が特定のファイルをコピーしている、またはコピーしていない理由を診断する

rsyncリモートサーバーからファイルを取得して処理するスクリプトがあります。これらのローカルコピーは実行間で削除されないため、rsync取得するだけで済みます。新しいファイル。ただし、キャッシュされたローカル コピーもサーバー コピーも変更されていない場合でも、毎回すべてのファイルをダウンロードしているようです。rsyncその理由はわかります。

rsync特定のファイルが今回の実行でコピーされる理由、またはコピーされない理由を診断するのに役立つ のコマンドライン引数はありますか? 試してみました-vが、必要な情報が得られないようです。次のようなものです:

> rsync --diagnose-why-files-copied remotehost:/remote/path ./local/path/
'remotehost:/remote/path/file1':
  Destination file './local/path/file1' does not exist; copying.

'remotehost:/remote/path/file2':
  Destination file './local/path/file2' exists...
  Destination file size does not match source file size; copying.

'remotehost:/remote/path/file3':
  Destination file './local/path/file3' exists...
  File sizes match...
  Destination file modification date does not match source file modification date; copying.

'remotehost:/remote/path/file4':
  Destination file './local/path/file4' exists...
  File sizes match...
  File modification dates match...
  No change detected; skipping.

> rsync -c --diagnose-why-files-copied remotehost:/remote/path2 ./local/path2/
'remotehost:/remote/path2/file1':
  Destination file './local/path2/file1' does not exist; copying.

'remotehost:/remote/path2/file2':
  Destination file './local/path2/file2' exists...
  Destination file checksum does not match source file checksum; copying.

'remotehost:/remote/path2/file3':
  Destination file './local/path2/file3' exists...
  File checksums match...
  No change detected; skipping.

答え1

-ii探していたものです。--itemize-changesオプションの短縮形 を-i使用すると、更新または変更された各ファイルに対して、そのファイルに対して何が行われたか、またその理由を識別する診断メッセージが出力されます。オプションを 2 回指定すると、まったく変更されていないファイルに対してもメッセージが出力されます。

関連情報