Directory Operations in Operating System
The system calls available for managing directories differ more from system to system than the system calls available for managing files.
The following is a list of common directory operations. In the bracket, I used the command used on the Windows platform to do the respective job.
Let's go over each of the above directory operations in brief.
Directory Operation: Create
To create a directory, use the directory "create" operation. You can create a directory manually or with the command. If you want to manually create a directory, simply navigate to any drive or directory, right-click, and select "New," then "Folder." There will be a new directory created.
Another option is to use the command to create a directory. To create a directory on the "Windows" platform, open the command prompt and type "mkdir directoryName" followed by the "ENTER" key. Let's take it one step at a time, with screenshots and examples.
To begin, launch the command prompt. To open the command prompt on the "Windows" platform, press "WindowsKey+R" and type "cmd," then press the "ENTER" key. Following the same steps as described here, this is the snapshot that appears in my system.
I highlighted "C:\Users\Dev>" to draw your attention. As shown in the command prompt, if we write any command like "mkdir codescracker," then the directory "codescracker" will be created in the directory (DEV), available inside "Users," whose root is "C-Drive." Here is the snapshot for your understanding:
Now to actually create a directory using the command prompt, type "mkdir codescracker" and hit the "ENTER" key. Here is the first snapshot.
The second snapshot, shown below, is of the same command prompt window after pressing the "ENTER" key.
If you go to the directory "Dev," you'll see that the directory "codescracker" has been added as a new directory. This is how we can approach the command for generating a new directory.
You can also use the command prompt to change directories and create any required directory in another directory. So to go one directory back, use "cd.." in this way.
If you create a directory now, it will be created in the "Users" directory rather than the "Dev" directory. To move one directory forward to another, use "cd existingDirectory," for example.
Directory Operation: Open
You can open the directory manually or from the command prompt using the "cd directoryName" command, as previously discussed when discussing the "create" operation. To manually open a directory, simply double-click on it.
Directory Operation: Rename
To rename the directory, use the "rename" operation. This operation can be done manually or through the command prompt. To rename a directory, type "ren oldName newName" on the command prompt and press the "ENTER" key.
Directory Operation: Delete
The directory is deleted using the "delete" operation. You can delete a directory manually or with the command. Manually deleting a directory is as simple as right-clicking on it, selecting "Delete," and then clicking "Yes."
Now, let's look at how to delete a directory with the command. On a Windows system, the command "rmdir" can be used to delete a directory.
To delete a directory from the default or any required directory, follow the same procedure as described in the "create" section.
That's all. These are the most fundamental directory operations that any operating system employs. I will not go into detail because this "operating system" course is intended for beginners, as I stated at the beginning of the course. And I believe that these particulars are adequate for beginners.
« Previous Topic Next Topic »
Follow/Like Us on Facebook
Subscribe Us on YouTube