1

I'm trying to concoct a way to grab two (nearly identical) directories and show me the difference between all files in the two directories.

Looking for two different things:

1- List all files (recursively) that are different between the two directories

2- Subtract all the files in /new-directory/ from /old-directory/ and output the results to a third directory or someplace where I can easily scan over the differences.

I'm looking for backdoors to a server by comparing a backed up (clean) directory to one with a suspected backdoor (inside a a previously existing file).

0

1 Answer 1

1

If your goal is to compare the files, you can use diff directly, for example in that way:

diff -r old-dir new-dir

With an option -q you can suppress the differences and get only a list which files differ, or if some files exist only in one of those directories.

$ diff -r old-dir new-dir
Only in old-dir: 2
diff -r old-dir/3 new-dir/3
0a1
> this line was inserted by an evil hacker... 

$ diff -rq old-dir new-dir
Only in old-dir: 2
Files old-dir/3 and new-dir/3 differ

There is also a graphical interface, called xxdiff which facilitate the screening of the differences; Screenshot taken from homepage:

enter image description here

2
  • Thanks! That's just what I was looking for. I didn't know if diff worked on a directory level.
    – Orun
    Mar 4, 2013 at 20:50
  • @OrunBhuiyan: Glad I could help. Btw. I think its uncommon here to thank "personally", just upvote and/or accept the answer -- and welcome to Superuser :)
    – mpy
    Mar 4, 2013 at 20:53

You must log in to answer this question.

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