LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   creating a recursive DIFF command (https://www.linuxquestions.org/questions/linux-newbie-8/creating-a-recursive-diff-command-576786/)

OtisLinux 08-13-2007 11:49 AM

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

lord-fu 08-13-2007 11:58 AM

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?

OtisLinux 08-13-2007 01:33 PM

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

chrism01 08-13-2007 07:34 PM

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


All times are GMT -5. The time now is 02:42 AM.