Results 1 to 6 of 6
Hey, this is perhaps an unusual request, perhaps not, but I'm sure its something that linux is very good at, I just need to know where to look
My situation ...
- 09-24-2007 #1Just Joined!
- Join Date
- Mar 2007
- Posts
- 93
program to compare directory structures
Hey, this is perhaps an unusual request, perhaps not, but I'm sure its something that linux is very good at, I just need to know where to look

My situation is this:
Currently I store all of my CDs on my PC instead of getting up and changing discs all the time etc. This also means that everything for my mp3 player is easily obtainable. For playing music at home I encode everything at a high bit rate for the best possible quality etc, but when I want music for my mp3 player I like to encode at around 96kbs (I was using 96kbs but I've now switched to using a vbr which produces files of a similar size as I'm told this will give me a much better quality)
To make it easy to find any track physically on the HDD I organise 99% of my Cds like this:
music/collection/artist/album/artist-trackname
I do this for every CD at a high bit rate, and then duplicate it at the lower bit rate in a separate directory with the exact same structure.
music/player/artist/album/artist-trackname
What I need to do is to be able to easily compare the two and see which files/folders are missing from each, at the moment I'm just opening two tabs in firefox and flicking back and forth, while that works on a small scale I'm sure you can see its limits. Any ideas?
- 09-25-2007 #2Just Joined!
- Join Date
- Jul 2007
- Posts
- 15
diff
The "diff" command should do this. You can check the man pages for further guidance, but I think a "diff -r dir1 dir2" is along the lines of what you're looking for.
- 09-25-2007 #3Linux Newbie
- Join Date
- Sep 2007
- Posts
- 160
I used xxdiff when I was doing pretty much the same thing. What diff does on a CLI basis, xxdiff does in a GUI. For me, it was more intuitive in the way it deals with directory trees.
- 10-02-2007 #4Just Joined!
- Join Date
- Mar 2007
- Posts
- 93
Is there a way to get diff to ONLY post the results that are missing from one directory, or output to a text file? Currently I'm getting pages of output saying that the files are different (but I know that - they have different bitrates) when I only want to look for missing files/directories and naming errors.
cheers, command is very helpful
- 10-03-2007 #5Just Joined!
- Join Date
- Jul 2007
- Posts
- 15
Pass the -q flag to the cmd. You could also pipe it through a grep.
diff -q foo/ bar/ | grep -i only
diff -q foo/ bar/ | grep -i only | tee dirs_cmps
or
diff -q foo/ bar/ | grep -i only > dirs_cmps
You might also want to think about setting up a script to automatically sync the directory tree.
- 10-04-2007 #6Just Joined!
- Join Date
- Mar 2007
- Posts
- 93
wow, grep is amazingly useful thanks!


Reply With Quote

