我目前正在使用BusyBox v1.16.2而 cp 命令不提供更新选项:
...
-u, --update
copy only when the SOURCE file is newer than the destination file
or when the destination file is missing
还有其他选择吗?
我会考虑使用find --newer参数,但我正在试图弄清楚如何做到(经过几次尝试......)。
BusyBox v1.16.2 multi-call binary.
Usage: cp [OPTIONS] SOURCE DEST
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY
Options:
-a Same as -dpR
-R,-r Recurse
-d,-P Preserve symlinks (default if -R)
-L Follow all symlinks
-H Follow symlinks on command line
-p Preserve file attributes if possible
-f Force overwrite
-i Prompt before overwrite
-l,-s Create (sym)links
答案 0 :(得分:3)
test file1 -ot file2 && cp file2 file1