Scripting help

Shawn Badger badger.shawn at gmail.com
Sun Aug 2 15:53:37 MST 2009


Same result with and without the -1 :(


On Sun, Aug 2, 2009 at 11:31 AM, Eric Shubert <ejs at shubes.net> wrote:

> Eric Shubert wrote:
> > Shawn Badger wrote:
> >> I have bee playing with this script for a while and I can't seem to find
> >> the magic to make it work right. The script basically takes all the avi
> >> files in in a folder and converts them to flash.
> >> Here is the simple script:
> >>
> >> #!/bin/sh
> >> ls *.avi|cut -d. -f1 | while read i
> >>     do
> >>     echo "this is the file "$i
> >>     ffmpeg -i $i.avi -ar 22050 -f flv ./flv/$i.flv
> >>     done
> >>
> >>
> >> The script does the first file it finds and then exits with no errors.
> >> If I comment out the ffmpeg line it runs as expected though all the
> files.
> >>
> >> Oh, I need to allow for spaces in the file names as well.
> >>
> >> Any ideas?
> >>
> >
> > #!/bin/sh
> > ls *.avi | while read fileavi
> > do
> >    filebase="${fileavi%.avi}"
> >    echo "this is the file: \"$filebase\""
> >    ffmpeg -i "$fileavi" -ar 22050 -f flv "./flv/$filebase.flv"
> > done
> >
>
> You'll need the -1 option on the ls command so that each file is on a
> separate line, and the read command will read the whole filename with
> spaces.
>
> --
> -Eric 'shubes'
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20090802/b0da669f/attachment.htm 


More information about the PLUG-discuss mailing list