Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-30-2012, 06:52 AM   #1
Registered: Sep 2005
Posts: 836

Rep: Reputation: 30
Comparing two directories and its contents

Is there a way to compare two directories? My objective is to compare two directories and identify files that are on one directory and is missing on the other one. The next thing I want to do is to compare the text files recursively on two directories.
Old 11-30-2012, 06:57 AM   #2
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 968
Blog Entries: 2

Rep: Reputation: 232Reputation: 232Reputation: 232
Old 11-30-2012, 06:59 AM   #3
Senior Member
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,991

Rep: Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100
Perhaps 'diff dir1 dir2'?
Note - diff also takes -r option for recursion
Old 11-30-2012, 07:03 AM   #4
Senior Member
Registered: Jan 2011
Posts: 4,605
Blog Entries: 7

Rep: Reputation: 1090Reputation: 1090Reputation: 1090Reputation: 1090Reputation: 1090Reputation: 1090Reputation: 1090Reputation: 1090
diff --brief --recursive --report-identical-files /folder1 /folder2
diff -qr /somedir/ /someotherdir/
Old 01-25-2013, 10:41 PM   #5
Registered: Sep 2005
Posts: 836

Original Poster
Rep: Reputation: 30
Thanks this is really helpful


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing Directories hawkfan50 Programming 1 05-14-2012 07:38 PM
comparing contents of folders newbiesforever Linux - Software 2 02-01-2009 09:44 PM
Comparing two files to get matched contents in another file using shell script pooppp Linux - Networking 3 08-05-2008 12:11 AM
comparing the contents of entire CDs newbiesforever General 3 08-26-2007 07:03 PM
Comparing files contents? hhegab Linux - Newbie 3 07-01-2004 12:45 AM

All times are GMT -5. The time now is 05:10 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration