Wednesday 9 September 2015

DIR operation

# Program: DIR operation
# Name:    Kishor M Sonawane
# Roll No: 115
#
ch=1
while [ $ch -ne 0 ]
do

echo "*******************"
echo "0.exitprogram"
echo "1.Creat  DIR"
echo "2.Rename DIR"
echo "3.Delete DIR"
echo "4.Structure"
echo "5. exit to shell"
echo "Enter choice:"
read ch
case $ch in
   1) echo "Enter DIR name:"
     read dname
     if [ -d $dname ]
       then
          echo "DIR Is Already Exist!!!"
       else
       mkdir $dname
       echo "DIR IS Creat:" $dname
      fi
      ;;
   2) echo "Enter DIR name:"
      read rname
      if [ -d $rname ]
       then
           echo "Enter the New /DIR Name:"
           read new
           mv $rname $new
        echo "DIR Rename" $rname "to" $new
      
       else
          echo "DIR Is Not Present!!!"
      fi
      ;;
  3) echo "Enter DIR name:"
     read rname
     if [ -d $rname ]
       then
           rm -R $rname
        echo "DIR Is Deleted!!!"
        else
           echo "DIR Is Not Present!!!"
      fi
      ;;

   4)  echo "Enter DIR name:"
     read sname
     if [ -d $name ]
       then
           echo "-:"$name "Structure :-"
           ls $name
    
        else
           echo "DIR Is Not Present!!!"
      fi
     
;;
5) exit
;;
   0)   echo "Thank you!!!"
        echo "You are exit from Program"
;;
*) echo "Wrong choice!!!"
;;
esac
done

No comments:

Post a Comment