From: "Nadav Har'El" <nyh@math.technion.ac.il>
To: Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
Cc: zsh-users@sunsite.dk
Subject: Re: Selecting leaf directories only
Date: Wed, 7 Feb 2001 12:46:19 +0200 [thread overview]
Message-ID: <20010207124619.F2450@leeor.math.technion.ac.il> (raw)
In-Reply-To: <000a01c090ef$5d8625f0$21c9ca95@mow.siemens.ru>; from Andrej.Borsenkow@mow.siemens.ru on Wed, Feb 07, 2001 at 01:18:50PM +0300
On Wed, Feb 07, 2001, Andrej Borsenkow wrote about "RE: Selecting leaf directories only":
> >
> > Isn't it true that the link count of leaf directories is exactly 2?
> > Therefore I would try **/*(/l2) .
> >
>
> Yep. Now that's real black magic :-)
Just watch out - the fact that the number of links of a directory is 2 plus
the number of its subdirectories, is true only on standard Unix filesystems.
If you mount a filesystem through SMB, or a CD-ROM, for example, it is no
longer true.
A relevant quote from the GNU find(1) manual that discusses this issue:
-noleaf
Do not optimize by assuming that directories con
tain 2 fewer subdirectories than their hard link
count. This option is needed when searching
filesystems that do not follow the Unix directory-
link convention, such as CD-ROM or MS-DOS filesys
tems or AFS volume mount points. Each directory on
a normal Unix filesystem has at least 2 hard links:
its name and its `.' entry. Additionally, its
subdirectories (if any) each have a `..' entry
linked to that directory. When find is examining a
directory, after it has statted 2 fewer subdirecto
ries than the directory's link count, it knows that
the rest of the entries in the directory are non-
directories (`leaf' files in the directory tree).
If only the files' names need to be examined, there
is no need to stat them; this gives a significant
increase in search speed.
--
Nadav Har'El | Wednesday, Feb 7 2001, 14 Shevat 5761
nyh@math.technion.ac.il |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |Why do doctors call what they do
http://nadav.harel.org.il |practice? Think about it.
next prev parent reply other threads:[~2001-02-07 10:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-07 7:44 Andrej Borsenkow
2001-02-07 8:59 ` Geoff Wing
2001-02-07 9:21 ` Andrej Borsenkow
2001-02-07 9:29 ` Andrej Borsenkow
2001-02-07 17:15 ` Artur Penttinen
2001-02-07 10:05 ` Akos Szalkai
2001-02-07 10:18 ` Andrej Borsenkow
2001-02-07 10:46 ` Nadav Har'El [this message]
2001-02-07 12:07 ` Andrej Borsenkow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010207124619.F2450@leeor.math.technion.ac.il \
--to=nyh@math.technion.ac.il \
--cc=Andrej.Borsenkow@mow.siemens.ru \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).