Find the answer to your Linux question:
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2007
    Posts
    95

    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?

  2. #2
    Just 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.

  3. #3
    Linux Newbie
    Join Date
    Sep 2007
    Posts
    164
    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.

  4. #4
    Just Joined!
    Join Date
    Mar 2007
    Posts
    95
    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

  5. #5
    Just Joined!
    Join Date
    Jul 2007
    Posts
    15
    Quote Originally Posted by Jonny88 View Post
    Is there a way to get diff to ONLY post the results that are missing from one directory
    Pass the -q flag to the cmd. You could also pipe it through a grep.
    diff -q foo/ bar/ | grep -i only

    Quote Originally Posted by Jonny88 View Post
    or output to a text file?
    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.

  6. #6
    Just Joined!
    Join Date
    Mar 2007
    Posts
    95
    wow, grep is amazingly useful thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •