Section 3.21. Deleting a Directory: rmdir


[Page 62 (continued)]

3.21. Deleting a Directory: rmdir

Although posterity is a good reason for keeping old things around, it can interfere with your disk usage in a multi-user system. I therefore decided to remove the "lyrics.draft" directory to avoid exceeding my modest disk quota. Before I removed it, I archived its contents using the cpio utility, which is described in Chapter 4, "GNU Utilities for Power Users" To remove the directory, I used the rmdir utility (Figure 3-24).

Figure 3-24. Description of the rmdir command.

Utility: rmdir { directoryName }+

The rmdir utility removes all of the directories in the list of directory names. A directory must be empty before it can be removed. To recursively remove a directory and all of its contents, use the rm utility with the -r option (described shortly).


I tried to remove the "lyrics.draft" directory while it still contained the draft versions, and received the following error message:

$ rmdir lyrics.draft rmdir: lyrics.draft: Directory not empty $ _ 


To remove the files from the "lyrics.draft" directory, I made use of the rm utility, described next.




Linux for Programmers and Users
Linux for Programmers and Users
ISBN: 0131857487
EAN: 2147483647
Year: 2007
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net