How to cp remaining files after failed attempt

I would try,

rsync -a /from/file /dest/file

you can use other options like --append, -P (--partial --progress). See man rsync for more info.

Or if you are using cp then use cp -u.

from man cp:

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

For partial file transfers, cp might not be what you need.

I suggest using rsync instead. Even when transfer fails, you can simply re-run the command at a later time, and it'll copy only the missing files.

Example:

$ rsync -aPEmivvz from/ to/

(will copy from/ into to/ directory)

Since rsync does syncing and checking after each transfer, ensuring files have been copied correctly is trivial.

The swich set -aPEmivvz is my standard go-to selection, whenever copying files over networks or external drives, including plug-in devices, like SD-Cards, etc.

These are the switches I use almost always:

-a: "archive", includes -rlptgo (recursive, symlinks as symlinks, permissions, times, group, owner)

-P: "partial progress" shows nice progress bar for each file

-E: "executability" preserve whether executable or not

-m: "noempty" prunes empty dirs

-i: "summary" print change summary for all updates

-vv: "more verbose"

-z: "compression"


What you probably want rather than cp in this case is rsync.

Just recursively copying one directory structure to a new location:

rsync -av /path/to/source /path/to/destination 

Tags:

Cp