Den*_*nis 68
将更新选项 (-u) 与 cp 一起使用应该可以为您完成。
http://beginnerlinuxtutorial.com/help-tutorial/basic-linux-commands/cp-linux-copy-command/
小智 26
使用rsync
rsync --progress -r -u /from/one/* /to/another/directory
Run Code Online (Sandbox Code Playgroud)
您没有说您使用的是什么外壳,所以我将假设ksh:
if [[ file1 -nt file2 ]]; then cp file1 file2; fi
Run Code Online (Sandbox Code Playgroud)