#!/bin/sh
echo -n "Please enter the path you want to convert the video:"
read path
if [ "$path" == "" ]
then
echo "ERROR: The input is empty."
exit 0
elif [ ! -d $path ]
then
echo "ERROR: Sorry,can't find this directory."
exit 0
else
cd $path
if [ $? != 0 ]
then
echo "ERROR: The path is in error, please check!"
exit 0
fi
fi
for d in `ls -d *`
do
cd $path/$d
if [ `ls *.flv | wc -l` -eq 0 ]
then
echo "ERROR: The path $path/$d is empty!"
break
fi
mkdir -p /outdir$path/$d
file=`ls *.flv`
for i in $file
do
/usr/bin/yamdi -i $i -o outfile
mv outfile /outdir$path/$d/$i
done
echo "$path/$d is OK!"
done