next up previous contents index
Next: Moving Information Up: Storing Information Previous: The Current Directory and

Using mkdir to Create Your Own Directories

;;

Creating your own directories is extremely simple under Unix, and can be a useful organizational tool. To create a new directory, use the command mkdir. Of course, mkdir stands for ma ke directory.

mkdir directory

Let's do a small example to see how this works:

screen5122

mkdir can actually take more than one parameter, and you can specify either the full pathname or a relative pathname; report-1993 in the above example is a relative pathname.

screen5126

Finally, there is the opposite of mkdir, rmdir for remove directory. rmdir works exactly as you think it should work: ;

rmdir directory

An example of rmdir is:

screen5140

As you can see, rmdir will refuse to remove a non-existant directory, as well as a directory that has anything in it. (Remember, report-1993 has a subdirectory, chap2, in it!) There is one more interesting thing to think about rmdir: what happens if you try to remove your current directory? Let's find out:

screen5146

Another situation you might want to consider is what happens if you try to remove the parent of your current directory. In fact, this isn't even a problem: the parent of your current directory isn't empty, so it can't be removed! ;;



Converted on:
Mon Apr 1 08:59:56 EST 1996