0

My music library is arranged like:

/data/music/Artist_-_Album[alac]/*.m4a

I need to be able to keep a copy of these in another format (apple lossless) and I'd want that like:

/data/music/Artist_-_Album[flac]/*.flac

This one liner is good at traversing directories and converting items to flac, but it leaves all of the files in the source directory... not optimal.

for f in /data/music/**/*.m4a; do avconv -i "$f" "${f%.m4a}.flac"; done

How can I change/edit/add to this script to make the output files to into a different folder that is named appropriately as shown above?

4
  • is there a specific reason you want to seperate the m4a from the flac files? ... also, could the folder with the m4a's in it contain folders too (i.e. /data/music/**/m4a/*.m4a and /data/music/**/flac/*.flac)?
    – txtechhelp
    Jan 1, 2014 at 22:50
  • Why separate them? I don't want duplicates. I don't want to offsite backup the m4a's, etc. Just easier to keep them somewhere else. Jan 2, 2014 at 0:25
  • Valid concerns :) .. Do you care if there's 2 separate folders in the main folder (i.e. /data/music/*/m4a/*.m4a and /data/music/*/flac/*.flac)? If not you can use the same script from above (with some adjustments), otherwise a little more script fu is needed for an answer
    – txtechhelp
    Jan 2, 2014 at 0:54
  • I really want them completely separate. The output location will probably be a different mount point completely. Jan 2, 2014 at 1:09

0

You must log in to answer this question.

Browse other questions tagged .