#####################################################################
#rename files
# 20.05.09
#  Modification: 09/09/09
####################################################################
#!/bin/bash

file=$(ls *.[jJgtrmaw][Ppiapv][Ggw3fwi])
  if [ ! "$file" ]
     then
       file=$(ls --hide=rename)
  fi

printf "$file \n"


############################################################33

echo -n "Enter File Name:"
read
 if [ "$REPLY" ]
    then
    echo "Name File: $REPLY   OK"
    name=$REPLY
    else
     while [ ! "$REPLY" ]
      do
      echo "----Error, No Enter Parametr!!!"
      echo -n "Enter Name File:"
      read
      done
name=$REPLY
echo "Name File: $name OK"
 fi
echo "----------------------------------"
######################################################################
echo -n "Enter Format File (jpg, gif, tif, raw, mp3, avi):"
read
 if [ "$REPLY" ]
    then
    echo "Format File: $REPLY   OK"
    formt=$REPLY
    else
     while [ ! "$REPLY" ]
      do
      echo "----Error, No Enter Format File!!!"
      echo -n "Enter Format File:"
      read
      done
     fi
format=$REPLY
echo "Name Format File: $format OK"

############################################################

echo "Format: $format OK"
a=0
for b in $file 
 do
    let "a+=1"
    echo "$b -->$name-$a.$format        OK"
    mv $b $name-$a.$format
 done
#rm rename

