I have the following directory structure:
/tmp1
\_ file1.txt
\_ file2.txt
/tmp2
\_ file1.txt
\_ file2.txt
\_ file3.txt
/changes
With rsync's --compare-dest option, I want to sync all files into /changes that are not present in /tmp1 but in /tmp2. Modified files in /tmp2 that differ from /tmp1 should also be synced to /changes.
When I execute the following command:
rsync -acvu --compare-dest=/tmp1/ /tmp2/ changes
file3.txt will be saved in changes. But also file1.txt although the md5 sum of the file in both directories is equal!
Did I miss some parameters for rsync? Thanks in advance!
UPDATE:
I find out that the files that shouldn't be synced have file permission -rw-rw-r-- others have -rwxrwxr-x. I can't find something about this behavior in relation to rsync.
Output of "ls -la" on both directories:
# ls -la /tmp1
-rw-rw-r-- 1 1001 1001 4 Dec 31 15:00 file1.txt
-rwxrwxr-x 1 1001 1001 6 Dec 31 15:00 file2.txt
# ls -la /tmp2
-rw-rw-r-- 1 1001 1001 4 Dec 31 19:31 file1.txt
-rwxrwxr-x 1 1001 1001 6 Dec 31 15:00 file2.txt
-rwxrwxr-x 1 1001 1001 2 Dec 31 15:00 file3.txt
# ls -la /changes
-rw-rw-r-- 1 1001 1001 4 Dec 31 19:31 file1.txt
-rwxrwxr-x 1 1001 1001 2 Dec 31 15:00 file3.txt
md5sum of file1.txt in both directories is equal!
/tmp1/file1.txt
have a different modification time to/tmp2/file1.txt
?