next up previous contents index
Next: Renaming a Directory: Up: List of Simple Previous: Creating a New

Removing an Existing Directory: rmdir

To remove an existing directory from your working directory, move to the target directory, delete all its files, move back to the parent directory, and then use the rmdir  command:

 
               		  cd  /u/useless 

pwd

/u/useless

rm -i *

cd ..

rmdir useless

The -i switch forces rm to prompt for confirmation before removing a file. If you try to remove a directory that is not empty, you will see a warning displayed. You may use the following shorter method instead of the above:
 
               		  rm  /u/useless/* 

rmdir /u/useless

or:
 
               		  rm  -r /u/useless 

The -r switch removes all files recursively from the directory tree.

Note that these do not delete the hidden files such as .login. For that issue the command

 
               		  rm  /u/useless/.*



Alan Silverman
Wed Apr 12 16:54:02 METDST 1995