Как имитировать режим синхронизации Echo с помощью командной строки rsync?

657
user19496

Инструмент MS SyncToy имеет 3 интуитивно понятных режима синхронизации (NB sync NOT backup) для синхронизации двух папок.

Один из них является:

Эхо, которое ищет изменения (изменения файлов, новые файлы, переименовывает, удаляет) в левой папке и вносит их в правую папку (односторонняя синхронизация).

Я использую внутренние GPT ext4 диски, Ubuntu 12.04 LTS, для локальной синхронизации.

Как имитировать режим синхронизации Echo с помощью командной строки rsync?

2
Я нахожу документацию rsync непонятной и противоречивой, поэтому я прошу предоставить правильные опции для ежедневной синхронизации двух папок, которые обрабатывают изменения файлов, новые файлы, переименовывают, удаляют, в разумной степени. user19496 10 лет назад 0

1 ответ на вопрос

1
totti

Currently rsync doesn't support this feature. This is on the feature request page of some site. Is has an option --fuzzy

 -y, --fuzzy This option tells rsync that it should look for a basis file for any destination file that is missing. The current algorithm looks in the same directory as the destination file for either a file that has an identical size and modified-time, or a simi‐ larly-named file. If found, rsync uses the fuzzy basis file to try to speed up the transfer. Note that the use of the --delete option might get rid of any potential fuzzy-match files, so either use --delete-after or specify some filename exclusions if you need to prevent this. 

freefilesync

Description:

folder comparison and synchronization tool This is a folder comparison and synchronization tool. It is optimized for highest performance and usability without restricted or overloaded UI interfaces.

Features:
* Multiple folder pairs
* Batch capability
* Binary comparison
* Handle conflicts and propagate deletions
* Optimized performance
* Transactional file copy
* ...

Mirror option in freefilesync
There is an award winning cross platform app called freefilesync( http://sourceforge.net/projects/freefilesync/ ) with nice GUI. It has a batch mode will allow you to schedule sync. It's xml file that define left,right folders for sync. Using this feature you can use freefilesync from terminal.

Thus you can sync files and folders using

*GUI
*BASH script
*cron

Do to its superb features and ease of use and script support FreeFileSync can be used as an alternative to rsync

Install

use PPA http://www.ubuntuupdates.org/ppa/getdeb_apps