 |
Index for Section 1 |
|
 |
Alphabetical listing for R |
|
 |
Bottom of page |
|
rmdir(1)
NAME
rmdir - Removes a directory
SYNOPSIS
rmdir [-p] directory...
STANDARDS
Interfaces documented on this reference page conform to industry standards
as follows:
rmdir: XCU5.0
Refer to the standards(5) reference page for more information about
industry standards and associated tags.
OPTIONS
-p Removes all directories in a path name. For each directory argument,
the directory entry it names is removed.
If the directory argument includes more than one path name component,
effects equivalent to the following command occur:
rmdir -p $(dirname directory)
That is, rmdir recursively removes each directory in the path name.
OPERANDS
directory
The path name of an empty directory to be removed.
DESCRIPTION
The rmdir command removes a directory from the system. The directory must
be empty before you can remove it, and you must have write permission in
its parent directory. Use the ls -al command to see if a directory is
empty.
If a directory and a subdirectory of that directory are specified in a
single invocation of rmdir, the subdirectory must be specified before the
parent directory so that the parent directory will be empty when rmdir
tries to remove it.
RESTRICTIONS
1. A directory must be empty before you can remove it, and you must have
write permission in its parent directory.
2. If the -p option is used, all directories in the path must be empty
except for the directory being recursively removed.
EXIT STATUS
The following exit values are returned:
0 Each directory specified by directory operand was successfully removed.
>0 An error occurred.
EXAMPLES
1. To empty and remove a directory, enter:
rm mydir/* mydir/.*
rmdir mydir
This removes the contents of mydir, then removes the empty directory.
The rm command displays an error message about trying to remove the
directories . (dot) and .. (dot dot), and then rmdir removes them.
Note that rm mydir/* mydir/.* first removes files with names that do
not begin with a . (dot), then those with names that do begin with a .
(dot). You may not realize that the directory contains file names
that begin with a . (dot) because the ls command does not normally
list them unless you use the -a option to see the files whose names
begin with a . (dot).
2. To remove all of the directories in the path name a/b/c, enter:
rmdir -p a/b/c
Use a command like this one if directory a in the current directory is
empty except that it contains a directory b and a/b is empty except
that it contains a directory c.
ENVIRONMENT VARIABLES
The following environment variables affect the execution of rmdir:
LANG
Provides a default value for the internationalization variables that
are unset or null. If LANG is unset or null, the corresponding value
from the default locale is used. If any of the internationalization
variables contain an invalid setting, the utility behaves as if none of
the variables had been defined.
LC_ALL
If set to a non-empty string value, overrides the values of all the
other internationalization variables.
LC_CTYPE
Determines the locale for the interpretation of sequences of bytes of
text data as characters (for example, single-byte as opposed to
multibyte characters in arguments).
LC_MESSAGES
Determines the locale for the format and contents of diagnostic
messages written to standard error.
NLSPATH
Determines the location of message catalogues for the processing of
LC_MESSAGES.
SEE ALSO
Commands: mkdir(1), ls(1), rm(1)
Functions: rmdir(2), unlink(2), remove(3)
Standards: standards(5)
 |
Index for Section 1 |
|
 |
Alphabetical listing for R |
|
 |
Top of page |
|