Chapter 7
Remove Directory (rmdir)
7.1 Do This
Source 11: Linux/Mac OSX Exercise
7
$ cd temp $ ls stuff $ cd stuff/things/frank/joe/alex/john/
$ cd .. $ rmdir john $ cd .. $ rmdir alex $ cd .. $ ls joe
$ rmdir joe $ cd .. $ ls frank $ rmdir frank $ cd .. $ ls things
$ rmdir things $ cd .. $ ls stuff $ rmdir stuff $ pwd ~/temp $
Source 12: Windows Exercise
7
> cd temp > ls Directory: C:\Users\zed\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 12/17/2011 9:03 AM stuff
> cd stuff/things/frank/joe/alex/john/ > cd .. > rmdir john
> cd .. > rmdir alex > cd .. > rmdir joe > cd .. > rmdir frank
> cd .. > ls Directory: C:\Users\zed\temp\stuff
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 12/17/2011 9:14 AM things
> rmdir things > cd .. > ls Directory: C:\Users\zed\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 12/17/2011 9:14 AM stuff > rmdir stuff
> pwd Path ---- C:\Users\zed\temp > cd .. >
7.2 You Learned This
I'm now mixing up the commands so make sure you type them exactly and pay
attention. Every time you make a mistake, it's because you aren't paying attention. If
you find yourself making many mistakes, then take a break or just quit for the day.
You've always got tomorrow to try again.
In this example you'll learn how to remove a directory. It's easy. You just go to the
directory right above it, then type rmdir DIR, replacing "DIR" with the name of the
directory to remove.
7.3 Do More
- Make 20 more directories and remove them all.
- Make a single path of directories that is 10 deep and remove them one at
a time just like I did above.
- If you try to remove a directory with contents you will get an error. I'll
show you how to remove these in later exercises.