Is there a way to let rsync only compare timestamps of files, and ignore their contents? That includes ignoring the file size. Just the timestamp. Nothing but the timestamp.
|
| ||||
|
feedback
|
|
Rsync cannot compare files using only the timestamp. It will always compare the file size regardless, and if you specify The whole point of rsync is to make one file tree match another. If a file in one tree has a different size to the same file in the other tree then they must, logically, differ. So rsync will copy it. Regardless. If you want to copy the files in the way you want you will have to adopt a different method using different tools. If you only want to copy files that have changed since a know date (say, the last time you copied the files) you can use find's -cnewer flag. The following little script will find files that have changed since the last time it was run:
The -cnewer compares the file's modified time to that of the specified file (/tmp/lastSync in this example):
The touch command will update the timestamp of /tmp/lastSync to reflect the fact that the script has just been run so that subsequent runs of the script use the current time as it's time base. The output of the find command can then be used to specify the files to copy to the destination using whatever method you like (cp, scp, whatever). | |||||
feedback
|
