[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: listing symbolic links recursively, with dir listing

From: Greg A. Woods
Subject: Re: listing symbolic links recursively, with dir listing
Date: Fri, 19 Jan 2001 13:14:14 -0500 (EST)

[ On Friday, January 19, 2001 at 11:25:43 (-0500), Larry Jones wrote: ]
> Subject: Re: listing symbolic links recursively, with dir listing
> Eric Siegerman writes:
> > 
> >     find . -type l -print | xargs ls -l
> > might be faster, since it doesn't require a fork/exec for each
> > symlink (to be honest, I don't actually know how "find -ls" is
> > implemented; there may not be any improvement if, like xargs,
> > it batches them up).
> It's even better -- find just prints out an ls-like line itself without
> forking or execing at all.

That's been true of all versions of BSD "find" since at least 4.3net2
(1991 or so), and is probably true for all versions with the '-ls'
option, but I think Eric's point might be that regardless of the
implementation of "find", use of '-print' and "xargs" will *always* be
the most portable way to use "find" and will give the best performance
possible for a portable implementation, and so that should be the
primary way suggested by any documentation (with an optional footnote to
mention that some versions might have slight enhancements).

Certainly traditional Unix "find" did not have an '-ls' option, and even
AT&T UNIX System V Release 4.2 doesn't have one, though I see that
SunOS-5.6 does, and no doubt GNU find (from findutils) does.....

Of course in these days of sharing filesystems with non-Unix clients
it's often a good idea to make sure you have a modern version of "find"
on hand so you can use '-print0' (and thus of course "xargs -0") so as
to protect yourself from any weird filenames with witespace and other
magic characters (eg. a newline) in their names!  :-)

                                                        Greg A. Woods

+1 416 218-0098      VE3TCP      <address@hidden>      <robohack!woods>
Planix, Inc. <address@hidden>; Secrets of the Weird <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]