xref: /freebsd/bin/rmdir/rmdir.1 (revision 315ee00f)
1.\"-
2.\" Copyright (c) 1990, 1993
3.\"	The Regents of the University of California.  All rights reserved.
4.\"
5.\" This code is derived from software contributed to Berkeley by
6.\" the Institute of Electrical and Electronics Engineers, Inc.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 3. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"	@(#)rmdir.1	8.1 (Berkeley) 5/31/93
33.\"
34.Dd March 15, 2013
35.Dt RMDIR 1
36.Os
37.Sh NAME
38.Nm rmdir
39.Nd remove directories
40.Sh SYNOPSIS
41.Nm
42.Op Fl pv
43.Ar directory ...
44.Sh DESCRIPTION
45The
46.Nm
47utility removes the directory entry specified by
48each
49.Ar directory
50argument, provided it is empty.
51.Pp
52Arguments are processed in the order given.
53In order to remove both a parent directory and a subdirectory
54of that parent, the subdirectory
55must be specified first so the parent directory
56is empty when
57.Nm
58tries to remove it.
59.Pp
60The following option is available:
61.Bl -tag -width indent
62.It Fl p
63Each
64.Ar directory
65argument is treated as a pathname of which all
66components will be removed, if they are empty,
67starting with the last most component.
68(See
69.Xr rm 1
70for fully non-discriminant recursive removal.)
71.It Fl v
72Be verbose, listing each directory as it is removed.
73.El
74.Sh EXIT STATUS
75The
76.Nm
77utility exits with one of the following values:
78.Bl -tag -width indent
79.It Li 0
80Each directory entry specified by a
81.Ar directory
82operand
83referred to an empty directory and was removed
84successfully.
85.It Li >0
86An error occurred.
87.El
88.Sh EXAMPLES
89Remove the directory
90.Pa foobar ,
91if it is empty:
92.Pp
93.Dl $ rmdir foobar
94.Pp
95Remove all directories up to and including
96.Pa cow ,
97stopping at the first non-empty directory (if any):
98.Pp
99.Dl $ rmdir -p cow/horse/monkey
100.Sh SEE ALSO
101.Xr rm 1
102.Sh STANDARDS
103The
104.Nm
105utility is expected to be
106.St -p1003.2
107compatible.
108.Sh HISTORY
109A
110.Nm
111command appeared in
112.At v1 .
113