Implementing Directory Management using Shell Script Last Updated : 22 Jan, 2019 Comments Improve Suggest changes Like Article Like Report Directory management constitutes the functions dealing with organization and maintenance of various directories. Directories usually contain files of any type, but this may vary between file systems. The content of a directory does not affect the directory object itself. Some of the directory functions are: Navigation Absolute/ Relative Pathnames Listing Directories Creating Directories Modifying Directories You can write your script in an editor like pico etc. Execute your files as mentioned below in the output screenshot. The following shell script implements these functions of directory management, using commands available in Linux. shell echo " " echo "----Implementing Directory Management----" echo " " ch=0 while [ $ch -lt 6 ] do echo "Press the following to :" echo "1) Create a new directory." echo "2) Modify a directory." echo "3) Navigate into directory." echo "4) Listing directories." echo "5) Exit." read ch case $ch in 1) echo " " echo "---Creation of Directory---" echo " " echo "Enter the name of the directory:" read name mkdir $name ;; 2) echo " " echo "---Modification of Directory---" echo " " echo "Enter the directory to be modified:" read orgdir echo "Press the following to :" echo " " echo "1) Rename directory." echo "2) Copy directory to another." echo "3) Move directory." echo "4) Delete directory." echo "5) Exit from Modify Mode." read modch case $modch in 1) echo " " echo "---Rename a directory---" echo " " echo "Enter new name for the directory:" read newname mv $orgdir $newname ;; 2) echo " " echo "---Copying a directory to another---" echo " " echo "Enter target directory:" read target mkdir $target cp $orgdir $target ;; 3) echo " " echo "---Moving a directory---" echo " " echo "Enter target directory:" read target mkdir $target mv $orgdir $target ;; 4) echo " " echo "---Deleting a directory---" echo " " rmdir $orgdir ;; 5) echo " " echo "---Exiting from modify mode---" echo " " exit ;; esac ;; 3) echo "---Navigation of Directory---" echo " " echo "Enter your choice for method of navigation :" echo "1) Go to Parent Directory. " echo "2) Navigate to specific directory." echo "3) Exit from Navigate Mode." read navch case $navch in 1) echo " " echo "---Parent Directory---" echo " " cd .. pwd ;; 2) echo " " echo "---Navigation to Specific Directory---" echo " " echo "Enter the target Path:" read path cd $path pwd ;; 3) echo " " echo "---Exiting from Navigate Mode---" echo " " exit ;; esac ;; 4) echo "--- Listing of Directories---" echo " " echo "Enter your choice for method of listing :" echo "1) List of directories. " echo "2) List of directories and their details." echo "3) Exit from List Mode." read lisch case $lisch in 1) echo " " echo "---List of directories---" echo " " ls ;; 2) echo " " echo "---Detailed List of directories---" echo " " ls -l ;; 3) echo " " echo "---Exiting from List Mode---" echo " " exit ;; esac ;; 5)echo " " echo "---Exiting---" echo " " exit ;; esac done Output: Comment More info T tanya_motwani Follow Improve Article Tags : Linux-Unix Explore Linux/Unix Tutorial 10 min read Getting Started with LinuxWhat is Linux Operating System 10 min read LINUX Full Form - Lovable Intellect Not Using XP 2 min read Difference between Linux and Windows 7 min read What are Linux Distributions ? 8 min read Difference between Unix and Linux 5 min read Installation with LinuxHow to Install Arch Linux in VirtualBox? 7 min read Fedora Linux Operating System 12 min read How to install Ubuntu on VirtualBox? 6 min read How to Install Linux Mint? 3 min read How to Install Kali Linux on Windows? 2 min read How to Install Linux on Windows PowerShell Subsystem? 2 min read How to Find openSUSE Linux Version? 2 min read How to Install CentOS 2 min read Linux CommandsLinux Commands 15+ min read Essential Unix Commands 7 min read How to Find a File in Linux | Find Command 9 min read Linux File SystemLinux File System 12 min read Linux File Hierarchy Structure 6 min read Linux Directory Structure 6 min read Linux KernelLinux Kernel 4 min read Kernel in Operating System 3 min read How Linux Kernel Boots? 11 min read Difference between Operating System and Kernel 3 min read Linux Kernel Module Programming: Hello World Program 7 min read Linux Loadable Kernel Module 7 min read Loadable Kernel Module - Linux Device Driver Development 4 min read Linux Networking ToolsNetwork configuration and troubleshooting commands in Linux 5 min read How to configure network interfaces in CentOS? 5 min read Command-Line Tools and Utilities For Network Management in Linux 8 min read Linux - Network Monitoring Tools 4 min read Linux ProcessProcesses in Linux/Unix 6 min read How to Manage Process in Linux 4 min read Getting System and Process Information Using C Programming and Shell in Linux 2 min read Process states and Transitions in a UNIX Process 4 min read Linux FirewallLINUX Firewall 7 min read iptables command in Linux with Examples 7 min read How to Configure your Linux Firewall - 3 Methods 12 min read Shell Scripting & Bash ScriptingIntroduction to Linux Shell and Shell Scripting 8 min read What is Terminal, Console, Shell and Kernel? 5 min read How to Create a Shell Script in linux 7 min read Shell Scripting - Different types of Variables 4 min read Bash Scripting - Introduction to Bash and Bash Scripting 12 min read Bash Script - Define Bash Variables and its types 12 min read Shell Scripting - Shell Variables 6 min read Bash Script - Difference between Bash Script and Shell Script 4 min read Shell Scripting - Difference between Korn Shell and Bash shell 3 min read Shell Scripting - Interactive and Non-Interactive Shell 3 min read Shell Script to Show the Difference Between echo â$SHELLâ and echo â$SHELLâ 4 min read Like