[CentOS] Locating the broken links

Mon Jan 28 02:45:05 UTC 2008
Ross S. W. Walker <rwalker at medallion.com>

Garrick Staples wrote:
> 
> On Mon, Jan 28, 2008 at 01:45:43AM +0200, Ioannis Vranos alleged:
> > Is there any command that I can use to find the broken 
> links that point 
> > to non-existent files?
> 
> Not pretty, but should work fine:
> 
> find . -type l 2>/dev/null| while read line;do  test -e 
> "$line" || echo "$line";done

Simpler way:

find . -L -type l -print

The -L tells find to follow symbolic links and use the file type
of the destination of the link instead of the link itself, so
it will only find files of type 'l' if it cannot find the file's
destination, a nice little side-effect.

-Ross

______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.