Find the answer to your Linux question:
Results 1 to 3 of 3
Hi A long time ago I came here with a query about comparing directory structures so that I could ensure I had 2 copies of all of my mp3's - ...
  1. #1
    Just Joined!
    Join Date
    Mar 2007
    Posts
    93

    Command to compare directorys

    Hi

    A long time ago I came here with a query about comparing directory structures so that I could ensure I had 2 copies of all of my mp3's - 1 in high quality and 1 in portable quality. The original thread is here http://www.linuxforums.org/forum/lin...tructures.html

    Now time has moved on I have begun to encode to flac, and I want to find and delete any mp3's that I now have as flac. The problem is, the file names are not always identical AND the extensions are different, meaning the command in the previous thread doesn't get me very far. The music is stored in the format of /home/music/mp3/Artist/Album/ and /home/music/flac/Artist/Album/ if I could just get a list of all the "album" subfolders which are duplicated I could work the rest by hand, any help will be appreciated, this is a big job!

    Thanks
    Jonny

  2. #2
    Linux Guru gogalthorp's Avatar
    Join Date
    Oct 2006
    Location
    West (by God) Virginia
    Posts
    3,105
    You can use wild cards with grep. See man grep from command line. grep is extremely powerful.

  3. #3
    Just Joined!
    Join Date
    Mar 2007
    Posts
    93
    I have made some progress with this,
    Code:
     diff /home/music/collection/mp3/ /home/music/collection/flac/ -q | grep -i common
    This outputs almost what I want, listing common sub-dirs but the problem is if both /flac/ and /mp3/ contain the same artist but not album then they still come out as common.

    I've been suggested
    Code:
    diff folder_a/[^.]* folder_b/[^.]* -R
    diff <(find /path1 -maxdepth 1 -type f|sort) <(find /path2 -maxdepth 1 -type f|sort)
    diff <(ls -l /path1 |awk ' $1!~/^d/ {print $NF}' |sort) <(ls -l /path2 |awk ' $1!~/^d/ {print $NF}' |sort)
    so far I can't get those to work, putting them here for future reference and perhaps somebody has an idea how to make one of them work

Posting Permissions

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