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. -Larry Jones Fortunately, that was our plan from the start. -- Calvin ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs
Re: listing symbolic links recursively, with dir listing
[ 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 ATT 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 [EMAIL PROTECTED] robohack!woods Planix, Inc. [EMAIL PROTECTED]; Secrets of the Weird [EMAIL PROTECTED] ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs
listing symbolic links recursively, with dir listing
I've just imported a directory structure into CVS that has a lot of symbolic links in it. I've written a script to restore these links from a file that lists what they are and where they point. However, I'm having trouble finding all the links now. I need to be able to recursively list all the symbolic links, and what subdirectories they're in. I can do a 'ls -lR | grep lrwx' and that will show me all the links and where they point, but I can't tell what subdirectory they're in. I need to be able to list them out and have the full path/filename listed... Does anybody have any suggestions on how to do this, or know of a utility that will do this? Thanx Kevin Hanser System Administrator Merchant Internet Group [EMAIL PROTECTED] ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs
Re: listing symbolic links recursively, with dir listing
Hanser, Kevin writes: I need to be able to recursively list all the symbolic links, and what subdirectories they're in. I can do a 'ls -lR | grep lrwx' and that will show me all the links and where they point, but I can't tell what subdirectory they're in. I need to be able to list them out and have the full path/filename listed... This really doesn't have anything to do with CVS, but find . -type l -print -Larry Jones I must have been delirious from having so much fun. -- Calvin ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs
Re: listing symbolic links recursively, with dir listing
find . -type l -print finds all symbolic links in the current directory and any subdirectories. prints their paths too. however, it doesn't print the output like 'ls' does, so you'd have to do something else to get the link's target. a better way would be to write a perl script to get all the symbolic links and then use readlink() to get the link's target. Colby Allred Advanced Hardware Architectures http://www.aha.com/ On Thu, 18 Jan 2001, Hanser, Kevin wrote: I've just imported a directory structure into CVS that has a lot of symbolic links in it. I've written a script to restore these links from a file that lists what they are and where they point. However, I'm having trouble finding all the links now. I need to be able to recursively list all the symbolic links, and what subdirectories they're in. I can do a 'ls -lR | grep lrwx' and that will show me all the links and where they point, but I can't tell what subdirectory they're in. I need to be able to list them out and have the full path/filename listed... Does anybody have any suggestions on how to do this, or know of a utility that will do this? Thanx Kevin Hanser System Administrator Merchant Internet Group [EMAIL PROTECTED] ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs
Re: listing symbolic links recursively, with dir listing
Lo, on Thursday, January 18, Hanser, Kevin did write: I've just imported a directory structure into CVS that has a lot of symbolic links in it. I've written a script to restore these links from a file that lists what they are and where they point. However, I'm having trouble finding all the links now. I need to be able to recursively list all the symbolic links, and what subdirectories they're in. I can do a 'ls -lR | grep lrwx' and that will show me all the links and where they point, but I can't tell what subdirectory they're in. I need to be able to list them out and have the full path/filename listed... Does anybody have any suggestions on how to do this, or know of a utility that will do this? Try find . -type l -print Richard ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs
Re: listing symbolic links recursively, with dir listing
Or you might try: find . -type l -exec ls -l {} \; David Glick Transmit Consulting, Inc 619-475-4052 [EMAIL PROTECTED] - Original Message - find . -type l -print finds all symbolic links in the current directory and any subdirectories. prints their paths too. however, it doesn't print the output like 'ls' does, so you'd have to do something else to get the link's target. a better way would be to write a perl script to get all the symbolic links and then use readlink() to get the link's target. Colby Allred Advanced Hardware Architectures http://www.aha.com/ On Thu, 18 Jan 2001, Hanser, Kevin wrote: I've just imported a directory structure into CVS that has a lot of symbolic links in it. I've written a script to restore these links from a file that lists what they are and where they point. However, I'm having trouble finding all the links now. I need to be able to recursively list all the symbolic links, and what subdirectories they're in. I can do a 'ls -lR | grep lrwx' and that will show me all the links and where they point, but I can't tell what subdirectory they're in. I need to be able to list them out and have the full path/filename listed... Does anybody have any suggestions on how to do this, or know of a utility that will do this? Thanx Kevin Hanser System Administrator Merchant Internet Group [EMAIL PROTECTED] ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs - Original Message - ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs
Re: listing symbolic links recursively, with dir listing
From: David Glick [EMAIL PROTECTED] Date: Thu, 18 Jan 2001 15:36:52 -0800 (PST) Or you might try: find . -type l -exec ls -l {} \; Or (depending on your version of find): find . -type l -ls (When I taught an Intro to Unix course, I recommended that my students re-read the find man page every few months. Every time I re-read it, I find something I didn't know before.) Chris -- Chris Garrigues http://www.DeepEddy.Com/~cwg/ virCIO http://www.virCIO.Com 4314 Avenue C Austin, TX 78751-3709 +1 512 374 0500 My email address is an experiment in SPAM elimination. For an explanation of what we're doing, see http://www.DeepEddy.Com/tms.html Nobody ever got fired for buying Microsoft, but they could get fired for relying on Microsoft. PGP signature
Re: listing symbolic links recursively, with dir listing
You make it too simple. From the "Real programmers don't eat quiche" manual: "If it was hard to write, it should be hard to understand and harder to modify"... g David Glick Transmit Consulting, Inc 619-475-4052 [EMAIL PROTECTED] - Original Message - From: David Glick [EMAIL PROTECTED] Date: Thu, 18 Jan 2001 15:36:52 -0800 (PST) Or you might try: find . -type l -exec ls -l {} \; Or (depending on your version of find): find . -type l -ls (When I taught an Intro to Unix course, I recommended that my students re-read the find man page every few months. Every time I re-read it, I find something I didn't know before.) Chris -- Chris Garrigues http://www.DeepEddy.Com/~cwg/ virCIO http://www.virCIO.Com 4314 Avenue C Austin, TX 78751-3709 +1 512 374 0500 My email address is an experiment in SPAM elimination. For an explanation of what we're doing, see http://www.DeepEddy.Com/tms.html Nobody ever got fired for buying Microsoft, but they could get fired for relying on Microsoft. - Original Message - ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs
Re: listing symbolic links recursively, with dir listing
Doesn't this do the trick? find . -type l -print | xargs ls -l --- Forwarded mail from [EMAIL PROTECTED] I've just imported a directory structure into CVS that has a lot of symbolic links in it. I've written a script to restore these links from a file that lists what they are and where they point. However, I'm having trouble finding all the links now. I need to be able to recursively list all the symbolic links, and what subdirectories they're in. I can do a 'ls -lR | grep lrwx' and that will show me all the links and where they point, but I can't tell what subdirectory they're in. I need to be able to list them out and have the full path/filename listed... Does anybody have any suggestions on how to do this, or know of a utility that will do this? --- End of forwarded message from [EMAIL PROTECTED] ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs
Re: listing symbolic links recursively, with dir listing
On Thu, Jan 18, 2001 at 05:42:52PM -0600, Chris Garrigues wrote: From: David Glick [EMAIL PROTECTED] Date: Thu, 18 Jan 2001 15:36:52 -0800 (PST) Or you might try: find . -type l -exec ls -l {} \; Or (depending on your version of find): find . -type l -ls This: 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). This is a modification of my standard trick for getting an ls -l with directories: find . -print | xargs ls -ld (The -d is crucial! Why is left as an exercise for the reader :-) (When I taught an Intro to Unix course, I recommended that my students re-read the find man page every few months. Every time I re-read it, I find something I didn't know before.) Quite possibly because it wasn't there before, or on the system whose man page you were reading last time, etc. The core functionality is pretty standard, but people (especially GNU) extend it in all sorts of weird and wonderful ways... -- | | /\ |-_|/ Eric Siegerman, Toronto, Ont.[EMAIL PROTECTED] | | / Interviewer: You've been looking at the stars all your life: Is there anything in astrology? Arthur C. Clarke: It's utter nonsense. But I'm a Sagittarius, so I'm naturally skeptical. ___ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs