To remove an empty directory, use the
command, as follows:
This will fail if there are any files or subdirectories in the directory. If this is so, you must either delete the files it contains, or move them to other directories. The only exceptions are the dot and dot-dot directories, which you cannot delete, and which are dealt with by the UNIX system itself.
You can remove a directory and any files it contains by using the
rm -r option, as follows:
rm -r directory
Be very careful when doing this because the -r option
tells rm to recursively enter any subdirectories
and remove their contents. You may remove more than you expect. It
is often safer to use the rm -i option. See
``Removing a file''
for information on interactive deletion.
You must have write permission on a directory before you can remove