Wednesday 25 September 2013

cp -rfu still prompting me to overwrite

 
Source: http://www.aliendev.com/tutorials/linux/linux-command-cp-still-promting-to-overwrite
 
Sometimes we want to copy a few folders and files over to a different directory, other times we might want to copy a lot of files and folders. One very common problem, is the normal way to force overwrite and not ask us for every single file doesn’t always work.
The normal way to do this, is to run this command:
cp -rf /source/dir /destination/dir
However, on a lot of machines, the default cp command is running as cp -i, which will hurt the chances of your -rf working successfully. The simple way to fix that, is to define the actual cp script like this:
/bin/cp -rfu /source/dir /destination/dir
I also like to use that -u command. It is the update command which makes it only overwrite files newer then the destination.

No comments: