Compare files in two directories | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Compare files in two directories

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-09-2013
mukulverma2408 mukulverma2408 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 4 September 2014, 7:17 AM EDT
Posts: 61
Thanks: 12
Thanked 2 Times in 2 Posts
Compare files in two directories

Hi All,
I have two directories that has some files, some of the files are common to both of them like :

Code:
ls -l dir1

file1
file2
file3


Code:
ls -l dir2

file1
file2
file3
file4
file5

Now i want to get the files from dir2 that are not present in dir1 (means i want to get file3,file4,file5).
I can do the same with a script but looking for something smaller and more standard.
Sponsored Links
    #2  
Old 01-09-2013
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 22 October 2014, 8:12 PM EDT
Location: Galactic Empire
Posts: 3,387
Thanks: 235
Thanked 1,209 Times in 1,135 Posts
Try diff command:

Code:
diff dir2 dir1

Sponsored Links
    #3  
Old 01-09-2013
mukulverma2408 mukulverma2408 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 4 September 2014, 7:17 AM EDT
Posts: 61
Thanks: 12
Thanked 2 Times in 2 Posts
yes, with a little manipulation i can make it work as required.
Thanks a lot.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to compare two files in different directories sravan008 Shell Programming and Scripting 2 09-29-2012 05:30 AM
How to compare files in 2 directories? Andre_2008 UNIX for Dummies Questions & Answers 1 09-24-2010 11:02 AM
compare all files under directories ga.miami56 UNIX for Dummies Questions & Answers 2 10-10-2009 01:31 AM
compare files in two directories and output changed files to third directory bkeep Shell Programming and Scripting 4 08-26-2009 06:58 AM
Compare files from two directories ravi214u Shell Programming and Scripting 2 07-14-2008 07:04 AM



All times are GMT -4. The time now is 12:44 PM.