On Dec 6, 2005, at 4:15 PM, Robin1229 wrote:
> while we're sort of on the subject, scott mentioned he would tell me
> what command to use to convert all the wav files in a folder to mp3
> using lame. i figured out how to do a conversion on one file, but i
> would like to do them all at the same time. thanks! robin
>> On Dec 6, 2005, at 3:41 PM, Scott Granneman wrote:
>>> lame captured.wav captured.mp3
>>>
>>> if you don't want to use lame, substitute oggenc.
The idea is to create a list of wav files and then cycle through
them, converting one at a time. For example,
for file in *.wav ; do
lame $file ${file%.wav}.mp3
done
The pattern "*.wav" creates the list.
The for..do..done loop interates down the list, assigning a new name
to the variable "file" each time.
The "lame" command converts the files. The ${//} syntax changes the
file ending from wav to mp3.
Personally, I'd add two extra items:
1) a check to see if the mp3 already exists. If it does, move on
the next wav file.
2) echo the lame command. This gives me a chance to review the
commands before I commit to them.
for file in *.wav ; do
[ -f ${file%.wav}.mp3 ] && continue
echo lame $file ${file%.wav}.mp3
done | sh
Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software. Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent
_______________________________________________
CWE-LUG mailing list
[email protected]
http://www.cwelug.org/
http://www.cwelug.org/archives/
http://www.cwelug.org/mailinglist/