Terminal Help, copying mp3s from sub directories into one directory

Discussion in 'Mac Basics and Help' started by Iiwii, Dec 19, 2011.

  1. Iiwii macrumors newbie

    Iiwii

    Joined:
    Mar 7, 2008
    #1
    I'm trying to copy mp3s from different subdirectories which is located in my Music directory but when i try cp *.mp3 ~/Desktop/Songs , i get an error saying no *.mp3 files were found
    I have tried cp -R *.mp3 ~/Desktop/Songs and also cp -a *.mp3 ~/Desktop/Songs

    when I am typing the command I am already in my "Music" directory, the songs are located in sub sub directories within that Music folder. I was able to do this by Google searching before but now I cant find it and I'm getting frustrated :-(
    any help/advise is great :)
     
  2. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #2
    Why are you trying to do this in Terminal, when Finder can do this quite simply?
     
  3. blevins321 macrumors 68030

    Joined:
    Dec 24, 2010
    Location:
    Winnipeg, MB
    #3
    Two issues with your statement -

    1-You need to do a recursive search, so that it will actually enter the subdirectories. So like cp - r /source /dest

    2 - Do you think you'll have issues with files in the various directories having the same file name? You'll need to decide how to handle those. If you do a -i in the command too, it'll ask you if you want to overwrite or not.
     
  4. Iiwii thread starter macrumors newbie

    Iiwii

    Joined:
    Mar 7, 2008
    #4
    I moves the Music folder to the Desktop as well as the Songs folder to make it easier for me,
    inside the Music folders I have a lot of directories and subdirectories (in itunes it moves all my songs it to it's own folder.) Artist is one folders and inside that folder is the Album then song.
    I tried cp -r ~/Desktop/Music/*.mp3 ~/Desktop/Songs
    I did that with -r -R and also -a (not at the same time) and all said no such file or directory

    If I try to do this in Finder I only know how to drag and drop which will work, but then I would have to do it to all the sub directories which would take me a very long time, unless there is a another method.

    Also there shouldn't be any issues with double file names.
     
  5. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #5
    I'm not sure I understand what you're trying to do. Are you wanting to copy your entire music folder, that contains subfolders, keeping the folder structure intact? If so, just copy the top folder and paste wherever you want it. That will copy all the contents of the folder, as well.

    If you only want to copy the songs, without the folder structure, you can use Finder to search the music folder for all music files, then Command-A to select all, Command-C to copy, then paste them wherever you want them.

    It would help if you explain what it is you're trying to accomplish by copying the files, in the first place.
     
  6. Iiwii thread starter macrumors newbie

    Iiwii

    Joined:
    Mar 7, 2008
    #6
    hehe your right I didnt explain my self properly, I wanted to take the mp3s from all the subdirectory and put them into one directory
     
  7. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #7
    So they'll all be in one folder, with no subfolders? If so, use the method in my last post.
     
  8. Iiwii, Dec 19, 2011
    Last edited: Dec 21, 2011

    Iiwii thread starter macrumors newbie

    Iiwii

    Joined:
    Mar 7, 2008
    #8
    yeah I was able to do it :) thanks!
    I can enjoy the rest of my day now :p
    Ps: in terminal you can also do
    cp -a /*/*/*.mp3 ~/Desktop/Songs
     

Share This Page