Re: [SLUG] links

From: Eben King (eben01@verizon.net)
Date: Sat May 17 2008 - 12:35:50 EDT


On Sat, 17 May 2008, James Forte wrote:

> On Fri, 16 May 2008, Eben King wrote:
>
>> No, not the browser.
>>
>> I can find all links by "find -type l ...". Fair enough, I can look for
>> the the red ones in "ls". I might miss one, though, so how do I find only
>> broken links?
>>
>> While we're at it, is there any means to maintain (or fix) cross-device
>> links so they'll work even if I move or rename the target?

> That should be
>
>
> for F in `find . -type l`
> do
> RES=`file $F`
> if echo $RES | grep broken
> then
> echo $RES
> fi
> done

Well, there are a lot of them, and I can't trust the names not to be odd
(spaces and quotes and ampersands, oh my), so:

find . -type l | while read F ; do
...

Actually, that form might not be OK with all of them, so I might have to go
with putting the "while" loop in a script and feeding it with "find . -type
l -print0 | xargs -0".

-- 
-eben      QebWenE01R@vTerYizUonI.nOetP      royalty.mine.nu:81
When we've nuked the world to a cinder, the cockroaches picking
over the remains will be crawling over the remaining artifacts
and wondering what "PC LOAD LETTER" means. -- PC / ASR
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:50:53 EDT