xref: /freebsd/bin/rmdir/rmdir.1 (revision f39bffc62c1395bde25d152c7f68fdf7cbaab414)
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.\" $FreeBSD$
34.\"
35.Dd March 15, 2013
36.Dt RMDIR 1
37.Os
38.Sh NAME
39.Nm rmdir
40.Nd remove directories
41.Sh SYNOPSIS
42.Nm
43.Op Fl pv
44.Ar directory ...
45.Sh DESCRIPTION
46The
47.Nm
48utility removes the directory entry specified by
49each
50.Ar directory
51argument, provided it is empty.
52.Pp
53Arguments are processed in the order given.
54In order to remove both a parent directory and a subdirectory
55of that parent, the subdirectory
56must be specified first so the parent directory
57is empty when
58.Nm
59tries to remove it.
60.Pp
61The following option is available:
62.Bl -tag -width indent
63.It Fl p
64Each
65.Ar directory
66argument is treated as a pathname of which all
67components will be removed, if they are empty,
68starting with the last most component.
69(See
70.Xr rm 1
71for fully non-discriminant recursive removal.)
72.It Fl v
73Be verbose, listing each directory as it is removed.
74.El
75.Sh EXIT STATUS
76The
77.Nm
78utility exits with one of the following values:
79.Bl -tag -width indent
80.It Li 0
81Each directory entry specified by a
82.Ar directory
83operand
84referred to an empty directory and was removed
85successfully.
86.It Li >0
87An error occurred.
88.El
89.Sh EXAMPLES
90Remove the directory
91.Pa foobar ,
92if it is empty:
93.Pp
94.Dl $ rmdir foobar
95.Pp
96Remove all directories up to and including
97.Pa cow ,
98stopping at the first non-empty directory (if any):
99.Pp
100.Dl $ rmdir -p cow/horse/monkey
101.Sh SEE ALSO
102.Xr rm 1
103.Sh STANDARDS
104The
105.Nm
106utility is expected to be
107.St -p1003.2
108compatible.
109.Sh HISTORY
110A
111.Nm
112command appeared in
113.At v1 .
114