Learn about Linux
Download Linux
Get Linux help
Get special offers on:
Linux Application Dev Programming Software
Email:
#
Return to CLI Magic: For geek cred, try these one-liners
© Copyright 1999-2008 - SourceForge, Inc., All Rights Reserved About Linux.com - Privacy Statement - Terms of Use - Advertise - Trademark - Ask Linux Questions - Write for Us - RSS Feed ThinkGeek - Slashdot - SourceForge.net - freshmeat - Surveys - Jobs
Re: CLI Magic: For geek cred, try these one-liners
Posted by: Anonymous [ip: 67.152.57.254] on July 24, 2008 03:08 PMI'd propose using find(1)
find . -name '*.wav' -maxdepth 2 | while read FILE; do lame -b 32 "${FILE}" "${FILE%.wav}.mp3"; done
The use of -maxdepth constrains the find(1) to the current dir and 1 level down.
Using $(ls -1) as an element list to a for loop runs the risk of overflow should there be a large number of files in a given directory.
Use of {xxx%yyy} is a nice construct.
I didn't know lame can convert from wav to mp3 (I've be using audacity for this) thanks for the hint.
#