[lug] Shell Scripting Help
Bamm Visscher
bamm.visscher at gmail.com
Tue Feb 14 12:13:04 MST 2006
The for loop treats the space as a seperator. Do something like
`export IFS=;` and run your one liner again. As long as you don't have
any semi colons in your filenames, it should work fine.
Bammkkkk
On 2/14/06, Dan Ferris <dan at usrsbin.com> wrote:
> So, I came into a bunch of MP4 formatted music files from my younger
> brother and naturally, I'd like to convert them to MP3 since dealing
> with MP3s is way easier in the long run at least for me. These aren't
> iTunes encrypted MP4s either, so there is nothing to crack or decrypt,
> just straight conversion.
>
> So being the geek that I am, I had my hopes of making a very simple
> shell script that would go through and convert all the m4a files using
> ffmpeg. Sounds simple right?
>
> So it seems obvious that one could do something like this:
>
> for i in `find . -name "*.m4a"`; do ffmpeg -i "$i" -acodec mp3 -ac 2 -ab
> 192 "${i%m4a}mp3"; done && find . -name "*.m4a" -exec rm -f \{\} \;
>
> A one line converter that will run for a few hours and give me the MP3
> files that I so desperately seek and rid my hard disk of the pesky MP4
> files.
>
> However, there is one little caveat and it's driving me INSANE and I'm
> ready to start throwing things.
>
> find will return a file such as this:
>
> ./AC_DC/The Razors Edge/01 Thunderstruck.m4a
>
> However, when you try to actually USE this file name in a script it
> shows up like this:
>
> ./AC_DC/The
> Razors
> Edge/01
> Thunderstruck.m4a
>
> None of the other commands show strange characters in the file name.
> I've tried to rid the output of funny characters with perl but nothing
> makes it go away.
>
> Thanks!
>
> Dan
>
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>
--
sguil - The Analyst Console for NSM
http://sguil.sf.net
More information about the LUG
mailing list