From: "Yong S. Yi" <ysyi@taco.async.org>
Subject: Re: Listing Directories (without files!)
Date: 2000/03/21 [thread overview]
Message-ID: <38D6DDC1.A86D96D@taco.async.org> (raw)
In-Reply-To: 38D68B81.4DFD654D@merkantildata.no
Knut Helleb^x wrote:
> I've always been doing ls -ld *|grep '^d' with success. Think this is
> faster than find if you're only wanting to investigate the current
> directory. You could also do a find -prune .... where prune makes the
> find command not descending into subdirectories (if I remember right).
Why `ls -ld *|grep ...`? Why not `ls -l|grep ...`?
Even though the two would do the same thing (minus the 'total'
difference with `ls -l` vs `ls -ld *`), a directory with lots of files
(which includes 50,000) wouldn't work quite right with this, AFAIK. The
shell (depending on how your system is configured) would have to expand
the '*', and complain that there are too many arguments. Try it, you'll
see.
If that doesn't bother you enough, simply the fact that the shell would
have to expand the '*' would be another step, hence taking longer. Why?
When you use '*', it would mean that the shell would have to read the
directory once to expand it. Then ls would have to do it again, etc.
So the fastest way? Code something yourself.
-y.
--
Yong S. Yi KeyID 1024/8B4FF151 http://www.async.org/~ysyi/
PGP Key Fingerprint = 3A 65 AE 82 07 2A EF 73 0B 84 67 5D 1D 96 9F 8D
<ysyi@alf.dec.com> Enriched, VCard, and HTML messages > /dev/null
prev parent reply other threads:[~2000-03-21 5:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-20 5:00 Listing Directories (without files!) Mark M.
2000-03-20 5:00 ` Andy Wagg
2000-03-20 5:00 ` Knut Hellebø
2000-03-20 5:00 ` Mark M.
2000-03-21 5:00 ` Yong S. Yi [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox