Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a list of files that I am copying around for various purposes. What my current command looks similar to this:

cat list_of_files | xargs -I {} /bin/cp -f {} /destination/dir

I am using the full path to cp so that the default alias of cp -i does not take effect. However, when I find a duplicate file, it is overwriting any that have already been copied. What I would like to do is to force cp to not overwrite and not prompt.

Is there any way to do this?

share|improve this question
up vote 6 down vote accepted

Try the cp -n 'noclobber' option.

It doesn't overwrite existing files and overrides a previous -i option.

share|improve this answer
you know, I read that man page 3 times, and it got past me every time. Thanks. – Kirk Jun 17 '11 at 23:54

The -n option should not overwrite an existing file.

share|improve this answer
and yet it does if you don't use other options like -d. – Praesagus Jul 17 '15 at 17:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.