我正在使用它cp -ruv sourcedir/ /mnt/destinationdir
来轻松维护文件树的备份。
有时,此命令会告诉我:
remove '/mnt/destinationdir/path/file'
我很惊讶,因为man cp
说:
--update[=UPDATE]
control which existing files are updated;
UPDATE={all,none,none-fail,older(default)}.
-u equivalent to --update[=older]. See below
UPDATE controls which existing files in the destination are
replaced. 'all' is the default operation when an --update option
is not specified, and results in all existing files in the
destination being replaced. 'none' is like the --no-clobber
option, in that no files in the destination are replaced, and
skipped files do not induce a failure. 'none-fail' also ensures
no files are replaced in the destination, but any skipped files
are diagnosed and induce a failure. 'older' is the default
operation when --update is specified, and results in files being
replaced if they're older than the corresponding source file.
何时会cp --update=older
删除目标目录中的所有文件?
编辑:上面的摘录针对的man cp
是 coreutils 9.5,我实际上使用的是 9.1,它具有较少的更新控制,但从该手册页来看,我猜它的行为不应该有所不同。