
Ich habe ein Skript, das rsync
Dateien von einem Remote-Server abruft und dann verarbeitet. Diese lokalen Kopien werden zwischen den Ausführungen nicht gelöscht, daher rsync
müssen nurneuDateien. Es scheint jedoch, dass rsync
jedes Mal jede Datei heruntergeladen wird, selbst wenn sich weder die zwischengespeicherte lokale Kopie noch die Serverkopie geändert hat, und ich kann herausfinden, warum.
Gibt es ein Befehlszeilenargument, mit rsync
dem ich diagnostizieren kann, warum eine bestimmte Datei bei diesem Durchlauf kopiert wird oder nicht? Ich habe es versucht -v
, aber es scheint mir nicht die Informationen zu geben, die ich brauche. Etwas wie:
> 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.
Antwort1
-ii
ist das, wonach ich gesucht habe. Die --itemize-changes
Option, Kurzform -i
, bewirkt, dass für jede aktualisierte oder geänderte Datei eine Diagnosemeldung gedruckt wird, die angibt, was mit ihr gemacht wurde und warum. Wenn Sie die Option zweimal angeben, wird die Meldung auch für Dateien gedruckt, die überhaupt nicht geändert wurden.