rsync: how to perform safe 2-way sync local<->remote webdav?

1

I have two directories:

  • /Volumes/webdav/ — mounted remote WebDAV disk
  • ~/files — local copy

I'd like to perform 2-way sync (manual) between them. What I'm doing:

$ rsync --exclude='.gitconfig' --exclude='*~' --exclude='.DS_Store' -varP ~/files/* /Volumes/webdav/ --delete

And vice versa (/Volumes/webdav/* ~/files/).

Questions

  1. What's the difference between ~/files/ /Volumes/webdav/ and ~/files/* /Volumes/webdav/? In first case I'm getting:

    building file list ...
    4498 files to consider
    

    in second:

    building file list ...
    1382 files to consider
    ...
    
  2. Sync logs often shows somehting like:

    building file list ...
    4498 files to consider
    .es/
    .es/�\#232а�\#200�\#202а Саи�\#206�\#202а.doc
           20480 100%    0.00kB/s    0:00:00 (xfer#1, to-check=4486/4498)
    .hb/
    .hb/25-512.png
           39036 100%    5.98MB/s    0:00:00 (xfer#2, to-check=4482/4498)
    .hb/icon-white-menu.png
            1546 100%    1.47MB/s    0:00:00 (xfer#3, to-check=4481/4498)
    .hb/icon-white.png
           26858 100%    0.00kB/s    0:00:00 (xfer#4, to-check=4480/4498)
    .pt/Untitled/
    .pt/session0/
    .pt/speed1/
    .pt/speed1/Session File Backups/
    .var/
    .var/DSC_6545.jpg
         4595455 100%   92.58MB/s    0:00:00 (xfer#7, to-check=4198/4498)
    .var/book_edit.pdf
    ...
    

    So, rsync shows some progress in transferring files, but if I start command again, it shows the same — transfers the same files, traverses the same folders, etc. Does it actually transfers something? If yes, why every time?

Thanks.

user2734

Posted 2016-11-10T13:42:41.977

Reputation: 11

You aren't showing the full run string. Are you using -u? Is the file time resolution the same on the destination volume as the source? Are you using --modify-window? – AFH – 2016-11-10T14:06:14.717

The difference between ~/files/ and ~/files/* is that the second will not include ~/files/.*: rsync recursion includes all files in a subdirectory, including dot-files, but using ~/files/* excludes the dot-files in ~/files/ before recursion; dot-files from subsequent levels of recursion will be included. – AFH – 2016-11-10T15:18:14.563

@AFH thank you! I've shown the full string in original message: rsync --exclude='.gitconfig' --exclude='*~' --exclude='.DS_Store' -varP ~/files/* /Volumes/webdav/ --delete About file time resolution: it's hard to say for me, cause it's a third-party WebDAV server. On my side I'm using macOS. Also, I've tried Unison file synchroniser and it also fails with The contents of file have been modified during transfer, which may point some issues with timestamps, I guess. – user2734 – 2016-11-10T18:01:55.563

I usually use ls --full-time to compare times, but I've a feeling that option doesn't exist on OSX. The other program which shows times with picosecond resolution is stat, which you can try on any any one of the files and its back-up copy. This will tell you if the time-stamps are identical, or if not how many seconds to use with --modify-window: 1 or 2 should be adequate. – AFH – 2016-11-10T22:59:16.413

No answers