Wednesday 9 September 2015

Create DIR and Change DIR

# proram : Create DIR and Change DIR
# Name :   kishor Sonawane

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. Change DIR"
echo "6. Display Node Details"
echo "7. 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             
          # rm -r use to delete all contain also
          #file & sub folder
        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)      echo " your Current DIR is:"
    echo "/ root"
        echo "- Privious Dir"
    echo ".. parent dir"
        echo "path : full path"
    pwd
    echo "Enter the DIR Address:"
        read path
        cd $path
        echo " your Current DIR is:"
        pwd
        echo "**************************************************"
        echo "All Files & Folders:"
        ls -l
        echo "**************************************************"
;;
6)  
     echo "All Info About Node " pwd
     ls
    echo "Enter the file name you want info it(MEta Data):"
        read inodef      #read inode file name
         echo "****************************************"
        echo "All Info (Inode) of an" $inodef
        stat $inodef     #stat is use to geting indode info of an file
        echo "*****************************************"
;;
7) exit
;;
   0)   echo "Thank you!!!"
        echo "You are exit from Program"
;;
*) echo "Wrong choice!!!"
;;
esac
done

No comments:

Post a Comment