non sarà il massimo...però funziona (se i file in questione non hanno spazi nel nome.......sinceramente non vedo perchè dovrebbero
)
codice:
#!/bin/bash
echo -ne "from..."
read from
if [ "$from" = "" ]; then
echo "Error."
exit 1
fi
echo -ne "to..."
read to
if [ "$to" = "" ]; then
echo "Error."
exit 1
fi
echo -ne "set bitrate to (in kbps)..."
read btrt
if [ "$btrt" = "" ]; then
echo "Error."
exit 1
fi
echo -ne "other options we should pass to lame (press\n"
echo -ne "<enter> for none)..."
read OTHOPT
echo -ne "do you like to set a prefix or suffix ?[prefix/suffix/no]\n"
read QSTN
if [ "$QSTN" = "prefix" ] ; then
echo -ne "$QSTN..."
read pre
elif [ "$QSTN" = "suffix" ] ; then
echo -ne "$QSTN..."
read suf
else
echo -ne "...ok..."
fi
if [ ! -d $to ]; then
mkdir -v $to
fi
cd $from
for dir in `find *` ; do
[ -d "$dir" ] &&
mkdir -v $to/$dir
done
for song in `find * | grep mp3`; do
[ -f "$song" ] &&
lame -q 0 -b $btrt --cbr "$OTHOPT" $song \
$to/$pre`echo -ne $song |sed "s/.mp3//g"`$suf.mp3
#TMOUT=8 read npt
# $npt
done
exit 0