Ask Your Question

using diff with directories

asked 2012-02-14 11:06:38 +0000

Hi guys,

I have a directory named souce1. then I copy contents to source2. then I add index.html in source2. I use diff to generate patch file:

diff -Naur source1 source2 > patch.txt

Now I delete source2. When I use patch < patch.txt to generate source2 it gives error:

The next patch would create the file index.html,
which already exists!  Assume -R? [n]

I read man pages but confused with a lot of options, can someone explain the usage of -N?? How can I fix this problem?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-02-14 15:27:11 +0000

updated 2012-02-14 15:28:00 +0000

You probably forget the -p option

patch -p0 <patch.txt


cd source1 ; patch -p1 <../patch.txt
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Use your votes!

  • Use the 30 daily voting points that you get!
  • Up-vote well framed questions that provide enough information to enable people provide answers.
  • Thank your helpers by up-voting their comments and answers. If a question you asked has been answered, accept the best answer by clicking on the checkbox on the left side of the answer.
  • Down-voting might cost you karma, but you should consider doing so for incorrect or clearly detrimental questions and answers.


Asked: 2012-02-14 11:06:38 +0000

Seen: 333 times

Last updated: Feb 14 '12

Related questions