I'm using cp -al to make some incremental backups in my computer. The -l flag tries to make a hard link instead of a real copy if the files are identical.

However, the following error raises from time to time:

"cp: cannot create link `...'. File exists"

What does it mean exactly? I've been searching on the web, but nobody seems to have a clear explanation. I've narrowed the issue to the following choices:

  1. The file already exists and it's a link, so no link is created again.
  2. The file already exists and it has changed indeed, so a real copy is made instead of a link.

The first one is obvious, but I do not understand why it would raise an error. You try to make a link, but there is a link already. The second one is less obvious, but it should be a normal behaviour, not something strange.

Any suggestions?

Thanks!

link|improve this question

feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.