Logo 
Search:

Dos Articles

Submit Article
Home » Articles » Dos » ScriptsRSS Feeds

Perform directory operations like display current , list, Make, Change directory and file operations like Copy, Rename, Delete, Edit based on menu

Posted By: Ben Evans     Category: Dos     Views: 4738

Menu based script to perform below operations on file and directory.

Display current directory
List directory
Make directory
Change directory
Copy a file
Rename a file
Delete a file
Edit a file

Code for Perform directory operations like display current , list, Make, Change directory and file operations like Copy, Rename, Delete, Edit based on menu in Dos

echo " 1...Display current Directory"
echo " 2...List Directory"
echo " 3...Make directory "
echo " 4...Change directory "
echo " 5...Copy a file "
echo " 6...Rename a fIle "
echo " 7...Delete a file "
echo " 8...Edit a file "

echo " Enter Your Choice: "
read ch

case $ch in
        1)
                pwd
                ;;
        2)
                ls
                ;;
        3)
                echo Enter directory name to make
                read dir_name
                mkdir $dir_name
                ;;
        4)
                cd
                ;;
        5)
                echo Enter two file name to copy
                read f_name1 f_name2
                cp $f_name1 $f_name2
                ;;
        6)
                echo Enter file name to rename
                read fname
                mv $fname
                ;;
        7)
                echo Enter file name to delete
                read fname
                rm $fname
                ;;
        8)
                echo Enter file name to edit
                read fname
                vi $fname
                ;;
        *)
                echo You hv entered wrong choice
                ;;
  
Share: 



Ben Evans
Ben Evans author of Perform directory operations like display current , list, Make, Change directory and file operations like Copy, Rename, Delete, Edit based on menu is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!