Way to compare contents of directories?

Discussion in 'macOS' started by netdog, Apr 3, 2008.

  1. netdog macrumors 603

    netdog

    Joined:
    Feb 6, 2006
    Location:
    London
    #1
    I copied my iTunes music folder to my Time Capsule to host the library from there and at some point, iTunes switched back to the old iTunes music directory in my home folder.

    I've looked in iTunes by sorting by date added, but that does me no good as some things I know were added later are listed at the same date as the last time the library compiled in this wrong directory. Everything is nested, so even if sorting by date in Finder, I can't see everything together.

    Is there any way to compare what is in each iTunes music directory (Time Capsule and Home Directory) to see what is missing from each? Does OS X have any such function or is there a 3rd-party utility that can do this easily?

    HELP!
     
  2. scaredpoet macrumors 604

    scaredpoet

    Joined:
    Apr 6, 2007
    #2
    In a Terminal window, use the "diff" command:

    Code:
    diff -rq <directory 1> <directory 2>
    This will show you a list of files that occur in directory 1 but not in directory 2, files that occur in directory 2 but not in directory 1, and files that exist but differ between the two directories.

    Output will look something like this:

    Code:
    caprica:~ scaredpoet$ diff -rq ./My_iTunes_Library /Volumes/backupdrive/iTunes_backup_files
    
    Only in /My_iTunes_Library/Beck: GameBoy Variations (Hell Yes Remix) - EP
    Only in /backupdrive/iTunes_backup_files/Beck/Odelay: Devil's Hairctu.mp3
    Only in /My_iTunes_Library/Beck/Odelay: Devil's Haircut.mp3
    
    ...
    
    
    Here I can see that I added a new album since my last backup, and also corrected the spelling on an MP3 file.

    If the two directories match 100%, you'll get no output, and you'l just get another command prompt.

    If there's too many differences to fit on one screen, direct the output to a text file:


    Code:
    diff -rq <directory 1> <directory 2> > differences.txt
    And if you have a big library, be patient. The diff command is thorough and may take some time.
     
  3. netdog thread starter macrumors 603

    netdog

    Joined:
    Feb 6, 2006
    Location:
    London
    #3
    Thanks for your answer! I am still a little stuck.

    Any ideas what tweaks I need to make here

    diff -rq /Jnana/Users/Thomas/Music/iTunes/iTunes Music/ /The Sea/iTunes Music/

    FWIW, the users directory is on a machine called Earth on a 2nd volume called Jnana (the first volume is just boot and apps) and The Sea library is on a Time Capsule called The Stars.
     
  4. netdog thread starter macrumors 603

    netdog

    Joined:
    Feb 6, 2006
    Location:
    London
    #4
    Any good sources for help on these naming conventions? I have been Googling, but haven't found any way to get this working.

    Is Time Capsule (The Stars) considered a computer? How do I address that in the command line?

    Also, the main volume is named Earth and the secondary volume with the primary library is named Jnana. As it is in my user directory, is there a short way to address it?
     
  5. vocaro macrumors regular

    Joined:
    Mar 5, 2004
    #5
    A number of directory comparison utilities are available: SmartSynchronize, Changes, FileMerge, and more.
     
  6. mgsarch macrumors regular

    Joined:
    Jan 19, 2008
    #6
    /Volumes/"The Sea"/Jnana

    Shortway to address home dir is: ~

    so

    ~/iTunes/Jnana

    ==

    /Users/<Home User>/iTunes/Jnana
     
  7. netdog thread starter macrumors 603

    netdog

    Joined:
    Feb 6, 2006
    Location:
    London
    #7
    That seems to be working. This community is amazing. Thank you!
     

Share This Page