从 BASH 中调用 cp 并使用 -u 选项

2 bash cp upgrade

有没有办法让cp's--update选项打印未复制的文件,因为源目录包含较新版本的文件?

jan*_*nos 5

替换cp -urrsync -urvv

两个“v”-s 没有错别字:它们在那里是为了增加冗长,以显示被跳过的文件。

跳过的文件看起来像the_filename is newer,因此要获取跳过的文件列表,您可以使用以下单行:

rsync -urvv source/ target | grep ' is newer$' | sed -e 's/ is newer$//'
Run Code Online (Sandbox Code Playgroud)

或者,如果您将以交互方式使用它,该--progress标志可能非常有用。