rmdir(1) rmdir(1)
NAME
rmdir - remove directories
SYNOPSIS
rmdir[ -p][ -s][ --] directory ...
DESCRIPTION
rmdir removes one or more empty directories. Directories containing
files cannot be removed with rmdir. To remove a directory together
with everything it contains you can use the rm command, specifying
option -r or -R.
OPTIONS
No option specified
rmdir removes the specified directories.
-p (p - parents) The specified directory is removed, and all empty
parent directories in the specified path are removed recursively.
A message is then written to standard output if a part of the
path still remains.
-s Suppresses the message written by the -p option.
-- End of the list of options. Must be specified if directory begins
with -.
directory
Name of the directory you want to remove.
You can name any number of directories.
ERROR MESSAGES
rmdir: dir1: Directory not empty
You have attempted to use rmdir to remove a directory dir1 which
still has files in it.
You can use the rm command with option -r or -R to remove direc-
tories that contain files.
rmdir: dir1: Directory does not exist
The directory named dir1 does not exist.
rmdir: ../dir1: Can't remove current directory or ..
The current directory or its parent cannot be removed. Change to
the parent directory.
Page 1 Reliant UNIX 5.44 Printed 11/98
rmdir(1) rmdir(1)
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
EXAMPLES
Removing the directories pro and proc.
The contents of your current working directory are:
drwxr-xr-x 11 susan other 5720 Nov 18 14:16 ./
drwxr-xr-x 13 root root 3380 Nov 04 11:48 ../
-rw------- 1 susan other 79 Jul 19 14:21 .profile
-rwx------ 1 susan other 125 May 25 10:29 begin
drwx------ 2 susan other 32 Oct 11 15:36 pro/
drwx--x--x 2 susan other 32 Nov 07 10:43 proc/
The directories pro and proc are empty, so you can remove them with
rmdir.
$ rmdir pro proc
$ ls -lpa
drwxr-xr-x 11 susan other 5720 Nov 18 14:16 ./
drwxr-xr-x 13 root root 3380 Nov 04 11:48 ../
-rw------- 1 susan other 79 Jul 19 14:21 .profile
-rwx------ 1 susan other 125 May 25 10:29 begin
Your current directory contains a directory dvz1. In dvz1 there is
another directory dvz2, and within that dvz3. dvz1 also contains the
file file1.
$ rmdir -p dvz1/dvz2/dvz3
rmdir: dvz1/dvz2/dvz3: dvz1 not removed; Directory not empty
SEE ALSO
rm(1), rmdir(2), unlink(2), remove(3C).
Page 2 Reliant UNIX 5.44 Printed 11/98