On Fri, 2005-12-16 at 09:25, Paul Eggert wrote: > I don't recall the earlier thread, but my kneejerk reaction is that > this sort of thing can be done fairly easily with commands like > "ls -l | grep '^d'". No doubt I'm missing something...
Yes, it's exactly what I wrote on my first mail about ls, find, test. My point is that on a populated directory (e.g. /dev on 2.4), filtering file types inside ls is faster than doing it externally by parsing a huge output. If d_type is supported by the file system, the additional cost for 'ls -P' is a stat() on directories and symlinks (this allows -R, -L and the like); otherwise (no d_type), a stat() is needed for every file (exactly as in both "ls -l" and "find -type") but the output is what you're looking for without further filtering. If -P is not used, there's no cost at all for ls (other than 2 or 3 if(0)...). Moreno _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils