Unix C++
Would you like to react to this message? Create an account in a few clicks or log in to continue.

compare files in different dir

4 posters

Go down

compare files in different dir Empty compare files in different dir

Post by akalya Tue Mar 09, 2010 4:49 pm

i want to compare two directories and list the files that are unique in each directory.....
how to i do it????

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

compare files in different dir Empty Re: compare files in different dir

Post by jeeva Tue Mar 09, 2010 5:04 pm

I tried something... dono if its a round about method... see if you get any idea

ls abcd>>xx.txt & ls chek>>yy.txt |comm xx.txt yy.txt

two directories here are abcd and chek

the first n second columns of the output are unique files Smile

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

Back to top Go down

compare files in different dir Empty Re: compare files in different dir

Post by Christopher Tue Mar 09, 2010 5:45 pm

try this :
Code:
ls -1 . ./chris | grep -v ':' | sort | uniq
it displays all the unique filenames in 2 directories.
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

compare files in different dir Empty Re: compare files in different dir

Post by DineshThangaraju Tue Mar 09, 2010 7:00 pm

The dircmp command:

format: dircmp -s dir1 dir2 | uniq

But it will not work here.. it works with some linux..

DineshThangaraju

Posts : 18
Points : 19
Join date : 2010-02-26
Age : 35
Location : India

Back to top Go down

compare files in different dir Empty Re: compare files in different dir

Post by Christopher Tue Mar 09, 2010 7:15 pm

do u know y it s not working here? s any packages missing?


Last edited by Christopher on Wed Mar 10, 2010 11:44 pm; edited 1 time in total
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

compare files in different dir Empty Re: compare files in different dir

Post by akalya Tue Mar 09, 2010 7:31 pm

@christopher

../chris....wat is this in ur code????

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

compare files in different dir Empty Re: compare files in different dir

Post by Christopher Tue Mar 09, 2010 8:37 pm

first dot(.) is for current directory and (./chris) is for "chris" directory inside current directory.
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

compare files in different dir Empty Re: compare files in different dir

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum