LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-13-2007, 11:49 AM   #1
OtisLinux
Member
 
Registered: Jan 2004
Posts: 108

Rep: Reputation: 15
creating a recursive DIFF command


Hi,
Hi,
I need to find the difference between 2 directories, basically I need to know what exists in the first directory that doesn't exist in the second directory. They are set up like the following:

/files/ ---(FIRST DIRECTORY)
file1 file2 file3 file4

/Files/ ---(SECOND)
0/
file1
1/
file2
2/
file3

The directory 'Files' has subdirectories which are supposed to contain all of the files in the directory 'files'. I need to find out if all of the files in /files/ are in /Files. I tried the command diff -r /files/ /Files/, but it was telling me that some of the files were only in 'files' when i know they existed in both.
Is there a better way to do this?
Thanks
 
Old 08-13-2007, 11:58 AM   #2
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
rsync would be a good candidate for this task. It can create/update/delete files from source to destination if you so desire.

man rsync

There are great examples on here, just use the search feature and type in rsync.

Hope it helps some.

Edit: oops I'm sorry I think I misread your post, are you wanting an output only and not an updating of the differences between the directories?

Last edited by lord-fu; 08-13-2007 at 12:00 PM.
 
Old 08-13-2007, 01:33 PM   #3
OtisLinux
Member
 
Registered: Jan 2004
Posts: 108

Original Poster
Rep: Reputation: 15
OK..
I have written a little script that basically gives me to txt files.
this.one this.two. Now I know that there are 3 items in this.one that are not in this.two. HOW do I use the DIFF command to show what they are, or where they are. I can't decipher the ouput when i use:
diff this.one this.two

Last edited by OtisLinux; 08-13-2007 at 03:00 PM.
 
Old 08-13-2007, 07:34 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,280

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Depends what your problem is.
you might want to use the following flags:
diff -bB file1 file2
see man diff
Maybe try comm instead.
 
  


Reply


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
writing a recursive 'find' command nadroj Programming 5 03-06-2007 01:06 AM
Recursive diff ( File compare ) script sharathkv25 Programming 5 02-22-2007 08:39 AM
can 'ls' command be recursive? Hailey's_Comet Linux - Newbie 3 10-01-2006 12:29 AM
help on diff command anandss2004 Programming 2 11-01-2005 12:58 PM
the lovely recursive(-R) command mikeghet Linux - Newbie 3 12-23-2004 03:46 PM


All times are GMT -5. The time now is 04:57 PM.

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