On 2020-07-22 14:00, 積丹尼 Dan Jacobson wrote:
> (info "(find) Directories") says
> 
>  -- Option: -maxdepth levels
>      Descend at most LEVELS (a non-negative integer) levels of
>      directories below the command line arguments.  '-maxdepth 0' means
>      only apply the tests and actions to the command line arguments.
> 
>  -- Option: -mindepth levels
>      Do not apply any tests or actions at levels less than LEVELS (a
>      non-negative integer).  '-mindepth 1' means process all files
>      except the command line arguments.
> 
> OK that is great, but not clear without examples.
> 
> Something like
> $ find -name Makefile
> ./comm/radio/radioscanningtw/maps/Makefile
> ./comm/air/m750/programs/a/Makefile
> ./comm/air/routes/programs/Makefile
> $ find -maxdepth 4 -name Makefile
> $ find -maxdepth 5 -name Makefile
> ./comm/radio/radioscanningtw/maps/Makefile
> ./comm/air/routes/programs/Makefile
> etc.

Thanks for the suggestion.  Fixed with the attached:

  [PATCH] doc: add examples for -maxdepth, -mindepth

Have a nice day,
Berny
>From 2c15992f5166ec983d5f800a08776aeb33a239d3 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Tue, 28 Jul 2020 21:32:45 +0200
Subject: [PATCH] doc: add examples for -maxdepth, -mindepth
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* doc/find.texi (-maxdepth): Add examples.
(-mindepth): Reference them.

Suggested by 積丹尼 Dan Jacobson <jida...@jidanni.org> in
https://lists.gnu.org/r/bug-findutils/2020-07/msg00006.html
---
 doc/find.texi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/doc/find.texi b/doc/find.texi
index 1e4ab177..ce63ca52 100644
--- a/doc/find.texi
+++ b/doc/find.texi
@@ -1358,12 +1358,31 @@ slice of a directory tree.
 Descend at most @var{levels} (a non-negative integer) levels of
 directories below the command line arguments.  @samp{-maxdepth 0}
 means only apply the tests and actions to the command line arguments.
+
+@example
+$ mkdir -p dir/d1/d2/d3/d4/d5/d6
+
+$ find dir -maxdepth 1
+dir
+dir/d1
+
+$ find dir -mindepth 5
+dir/d1/d2/d3/d4/d5
+dir/d1/d2/d3/d4/d5/d6
+
+$ find dir -mindepth 2 -maxdepth 4
+dir/d1/d2
+dir/d1/d2/d3
+dir/d1/d2/d3/d4
+@end example
 @end deffn
 
 @deffn Option -mindepth levels
 Do not apply any tests or actions at levels less than @var{levels} (a
 non-negative integer).  @samp{-mindepth 1} means process all files
 except the command line arguments.
+
+See @samp{-maxdepth} for examples.
 @end deffn
 
 @deffn Option -depth
-- 
2.28.0

Reply via email to