2

I found on another question how to do singular files, which worked great.

"lame --mp3input -b birtratenumber input.mp3 output.mp3"

Thing is, I have around 60 files and doing each individually is very time consuming (the total amount of time does not bother me, it´s more about having to stay there waiting to input the next command).

So, Is there a way to run this command for all files in the folder, telling it to use the same filename as source filename but adding "_48" at the end of it, before the .mp3 part and saving it in the source folder (same folder as original files).

Thanks in advance for any and all help.

  • Have you tried anything yourself? This sounds fairly trivial and should be easy given a bit of research effort. – Reticulated Spline Apr 05 '15 at 20:11
  • I have, I searched on google for quite a while, unfortunately my command line knowledge is limited and all I could find where commands that did not rename files, where meant for other operations (like wav to mp3) or did not know what to change in order to make it apply. My specialty is in hardware, software however... is not my forte, specially when it comes to command line scripts – Luciel Campbell Apr 05 '15 at 20:18
  • Break down the problem into smaller discrete chunks and tackle them one at a time. For example, how to accept command line arguments, how to iterate through a list of file names, etc. Research and try to implement each individually. If you get stuck on a specific aspect, you can ask your question here, but as it stands now, your question is too broad and shows no effort (even if you made some; which is why you should post any code you've tried that didn't work, and explain what you expected to happen and what happened instead.) – Reticulated Spline Apr 05 '15 at 21:31
  • Ok will try this. I did not post the command combinations I tried as I did not see it relevant, I understand better now what kind of site stackoverflow is, I will try to specify many more details in future questions, thanks. – Luciel Campbell Apr 06 '15 at 03:34

1 Answers1

3

Use a shell for loop to process the files in turn:

for i in *.mp3; do
     lame --mp3input -b 48 "$i" "${i%%.mp3}_48.mp3"
done
Toby Speight
  • 27,591
  • 48
  • 66
  • 103