是否有任何复制更新替代命令?

时间:2013-10-11 09:09:57

标签: linux unix embedded cp busybox

我目前正在使用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

1 个答案:

答案 0 :(得分:3)

test file1 -ot file2 && cp file2 file1