I have two directories which are different versions of the same software package. I'd like to list all the files/directories that have changed between the two then copy those differences to a new directory.

I've been trying different scripts with md5sum and diff -Nurq but haven't been able to get the result I'm looking for.

Any recommendations?

  • What does it mean to "copy a difference"?
    – cjm
    Commented May 17, 2011 at 18:35
  • I don't understand what you're trying to do. diff -r (or variations) gives you the differences already. What are you trying to do with them? Commented May 17, 2011 at 20:20

2 Answers 2


You should use rsync instead. Something like rsync -rv $old/ $new/ should do the trick: this will print the files it's going to copy over.

Run with additional -n for a dry-run before actually modifying the new directory.


The best tool that I have found is using vim with the DirDiff plugin. If you use vim and vimdiff, this Plugin will be easy to learn.

The author describes it this way:


This is a utility that performs a recursive diff on two directories and generate a diff "window". Based on that window you can perform various diff operations such as opening two files in Vim's diff mode, copy the file or directory recursively to the other, or remove the directory tree from the source directory.

DirDiff is like using vimdiff to compare two directories, and all subdirectories and files contained therein. I use this tool often for comparing different Subversion branches, configuration directories on different hosts, etc.

For a screenshot, look at dedm's blog: http://dedm.livejournal.com/115224.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .