]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: rmdir --recursive substitutes
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 19 Jan 2021 05:08:39 +0000 (21:08 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 19 Jan 2021 05:09:27 +0000 (21:09 -0800)
* doc/coreutils.texi (rmdir invocation): Add note on how to remove
empty subdirectories recursively.

doc/coreutils.texi

index fe2fc52b793ab572c53cb04d3c3b2099bb1d6f40..94c9fbfa56074e1b99d93101609c4ffd66147650 100644 (file)
@@ -11006,7 +11006,19 @@ Give a diagnostic for each successful removal.
 
 @end table
 
-@xref{rm invocation}, for how to remove non-empty directories (recursively).
+@xref{rm invocation}, for how to remove non-empty directories recursively.
+
+To remove all empty directories under @var{dirname}, including
+directories that become empty because other directories are removed,
+you can use either of the following commands:
+
+@example
+# This uses GNU extensions.
+find @var{dirname} -type d -empty -delete
+
+# This runs on any POSIX platform.
+find @var{dirname} -depth -type d -exec rmdir @{@} +
+@end example
 
 @exitstatus