Question

I'm currently using a BusyBox v1.16.2 and cp command does not provide update option:

...
-u, --update
copy  only  when  the  SOURCE file is newer than the destination file
or when the destination file is missing

Is there any alternative?

I would think of using find --newer parameter, but I'm trying to figure out how to do it (after a few tries...).

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
Was it helpful?

Solution

test file1 -ot file2 && cp file2 file1
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top