Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Apr 2000 15:53:25 +0100
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        Shawn Barnhart <swb@grasslake.net>
Cc:        questions@FreeBSD.ORG
Subject:   Re: 'find' command -- maxdepth option?
Message-ID:  <20000428155325.A86507@strontium.scientia.demon.co.uk>
In-Reply-To: <04f101bfb116$e4baafa0$b8209fc0@marlowe>
References:  <04f101bfb116$e4baafa0$b8209fc0@marlowe>

next in thread | previous in thread | raw e-mail | index | archive | help
Shawn Barnhart wrote:

> Maybe I'm just braindead, but is there a way to make Freebsd's find command
> not recurse a directory hierarchy?  Gnu find has a -maxdepth directive that
> lets you specify how deep to go.

Look at -prune.  If you only want to find files in the current directory,
try something like,

find . \( ! -name . -type d -prune \) -or \( other_contition -print \)

where "other_condition" should be replaced appropriately.  If you want
the directories printed as well, put "-print" after "-prune" or remove
the "-print" from the end, making the default to print any file matching
either condition.

This probably doesn't work the same as -maxdepth but it might work for
what you want.

-- 
Ben Smithurst / ben@scientia.demon.co.uk / PGP: 0x99392F7D


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000428155325.A86507>