LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to find the difference between two directory structures (https://www.linuxquestions.org/questions/linux-general-1/how-to-find-the-difference-between-two-directory-structures-778678/)

sr71919 12-29-2009 07:44 AM

How to find the difference between two directory structures
 
Hi all,
How to find the difference between two directories, need a summary of all the added, updated, deleted files/directories.
Like diff is for files, what is for directories?

imitheos 12-29-2009 07:51 AM

Quote:

Originally Posted by sr71919 (Post 3807793)
Hi all,
How to find the difference between two directories, need a summary of all the added, updated, deleted files/directories.
Like diff is for files, what is for directories?

Since you mentioned diff, if you run "diff -r dir1 dir2" it will produce
a diff output of all the changes of same-named files in both dirs. It will
also tell you which files exist only in the one (added) or the other dir (deleted).

Depending on what you want the output may not be pretty/parseable but
you can try it.

sr71919 12-29-2009 07:54 AM

Manually it can be done using find/grep/diff etc, but i need a tool for the purpose of saving time.

Pl Suggest any other quicker way.

AlucardZero 12-29-2009 08:36 AM

Code:

ls -AlR /dir1 > /tmp/dir1
ls -AlR /dir2 > /tmp/dir2
diff /tmp/dir1 /tmp/dir2



All times are GMT -5. The time now is 02:54 PM.