Update / overwrite files and directories recursively with Linux mv - cp commands

Submitted by Anonymous (not verified) on Thu, 03/19/2009 - 17:05

Update / overwrite files and directories recursively with Linux mv - cp commands

You want to update / upgrade your system. Its not easy as you think to copy or move new files with overwriting old files on linux. I know you think "--force" will help you, but not here!

With move command 'mv' it was not possible to update all files and directories. Therefore we use copy command 'cp'.

#mv new/files/* files or #mv -f new/files/* files
mv: cannot overwrite directory ...

#cp -af new/files/* files
cp: overwrite '...'?

You have type "yes" many times.

The solution:

#yes | cp -a new/files/* files