Have you ever thought about where these directories on the disk come from? In fact, these directories are created by ourselves. The purpose of these directories is to classify and organize files. If we have a new type of files, we need to create a new directory. The two commands we want to learn today are to perform directory operations. They are MD (make directory — create directory) and Rd (remove directory — delete directory).
These two commands are very simple. For example, my name is little doctor. I want to put my files in a directory. I can enter MD Xbs to create my directory. At this time, if you use the dir command, you will find that there is another directory Xbs under the root directory.
You might as well practice, create a directory called XYZ, and then enter dir. Can you see the XYZ directory? If you see it, you will succeed (hehe, this lesson is half finished). Now let’s go to this directory, type CD XYZ, and notice if the prompt has changed. OK, enter the dir command. It’s strange, isn’t it? We have just established this directory. It is reasonable to say that there should be nothing in this directory. In fact, no matter what directory you create, this And Will appear in the directory because Represents the directory itself Represents the directory above this directory. Obviously, since a directory already exists, it is impossible not to have itself or a higher-level directory. (.. you used it, remember? It’s CD… To return to the previous directory).
Once again, create a directory in the XYZ Directory: ABC, (the correct method is to enter MD ABC) use the dir command to see that the ABC directory is displayed, which shows that you have successfully learned to create a directory.
Since you can create a directory, of course, you can delete it. The RD command does this. For example, to delete the ABC directory, enter Rd ABC. If you don’t believe it, use the dir command to see if the ABC directory is gone. Is it very simple? To delete a subdirectory under the current directory, enter Rd space and subdirectory name to complete the task.
However, you should pay attention to some problems when using the RD command (otherwise you won’t want to delete some directories all your life). Take a good look at the following points:
Now you practice again (if you succeed this time, you will graduate successfully. You can learn the next lesson at ease). What should you do if you want to delete your current XYZ directory?
Correct answer: enter CD The command returns to the previous directory, and then enter Rd XYZ to delete the XYZ directory.