Operating Systems > Linux and UNIX

Converting multiple files to mp3

<< < (2/6) > >>

voidmain:
Yeah, the way I usually do it is using bash's builtin text replacement. It would be valuable to get familiar with this as it makes life really easy for many situations like this. See the section on "Parameter Expansion" in the bash man page. This way you call no external programs except for the one you want to run to perform the actual task you need to have done.

Agent007:
Void Main,

A minor glitch...The wav files which have names separated by spaces do not get processed.

Example,
this is a song.wav

where should i make the changes?

thanks,
007

 
quote:Originally posted by void main:


How about:

$ for i in *.wav; do lame --preset $i ${i%%.wav}.mp3; done
--- End quote ---

Stryker:
i believe my example solves that problem, although i am curious to void main's solution.

flap:

quote:Originally posted by Agent007:
Void Main,

A minor glitch...The wav files which have names separated by spaces do not get processed.

Example,
this is a song.wav

where should i make the changes?

thanks,
007

 
--- End quote ---


Use Stryker's solution instead. The difference between that one and Void's is that it will work with files whose names contain spaces.

beltorak0:
yeah, unfortunately, the "for name in *" command will separate the input list on newlines and spaces; unfortunately I have found no workaround for this limitation....  even setting $IFS to a newline doesn't do it.

And i think, stryker, that you have your names backwards; your commands find all mp3's and rename them to wav's (not sure how lame would react if it was given an mp3 as the imput and you told it to recode to mp3);  shouldn't it be:

--- Code: ---
--- End code ---

or, this might be a little simpler and not have to call sed each time:

--- Code: ---
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version