2011年6月14日星期二

rsync delete 参数

抄的抄的,原文见: http://superuser.com/questions/156664/rsync-delete-options
我好奇的是什么时候才需要考虑具体的delete方式。

--del/--delete_during Deletes files from the destination dir as they are copied (saves memory compared to --delete-before: --delete-before makes a separate scan to look for deleteables)
--delete Deletes files in the destination directory if they don't exist in the source directory.
--delete-before Delete files in the destination directory before coping file-with-same-name from source directory
--delete-during Delete files in the destination directory WHILE copying file-with-same-name from source directory
--delete-delay Mark deletes during transfer, but wait until transfer is complete
--delete-after Receiver deletes after transfer, not before...If some other part of the rsync moved extra files elsewhere, you'd want this instead of --delete-delay, because --delete-delay decides what its going to delete in the middle of transfer, whereas --delete-after checks the directory for files that should be deleted AFTER everything is finished.
--delete-excluded Deletes files from the destination directory that are explicitly excluded from transferring from the source directory.


The point of rsync is not copying, it is archiving. This is an important distinction. Processing deleted/changed files is critical, and in many cases nuanced.

Most of the other options are space or performance related. When you delete the files is important if you want to make sure the transfer is successful before you do anything, but if your device is too small to handle 2 copies of all the information, you need to delete as you go, etc. It's a little wacky because of it's long history across multiple platforms: some options have been added so that people who were used to certain behaviour wouldn't be confused.

没有评论:

发表评论