Home > Linux > cp with force overwrite

cp with force overwrite

by paul on April 13, 2009

I was recently trying to copy a directory over an existing one and kept getting prompted – asking if I wanted to overwrite existing files – even though I was using the force option:

cp -Rf dir1 dir2

I found the answer here – it was caused by an alias forcing the interactive mode.

Quick solution is to bypass the alias by an absolute reference to cp:

/bin/cp -Rf dir1 dir2

Leave a Comment

Previous post:

Next post: