$ rsync -av -r -d --delete SRC DEST
–archive, -a:

Archive mode

–verbose, -v:

Increase verbosity

–recursive, -r:

Recurse into directories

–dirs, -d:

Transfer directories without recursing


Delete extraneous files from dest dirs

关于 -r-d 的区别,rsync(1) 如是说:

Tell the sending side to include any directories that are encountered. Unlike --recursive, a directory’s contents are not copied unless the directory name specified is “.” or ends with a trailing slash (e.g. “.”, “dir/.”, “dir/”, etc.). Without this option or the --recursive option, rsync will skip all directories it encounters (and output a message to that effect for each one). If you specify both --dirs and --recursive, --recursive takes precedence.



如果你有任何意见,请在此评论。 如果你留下了电子邮箱,我可能会通过 回复你。