Is there any command that I can use to find the broken links that point to non-existent files? Thanks a lot.
On Mon, Jan 28, 2008 at 01:45:43AM +0200, Ioannis Vranos wrote:> Is there any command that I can use to find the broken links that point to > non-existent files?cleanlinks from the imake package may help. Mihai
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 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20080127/afce2c32/attachment-0002.sig>
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";doneI am trying "cleanlinks" and is cleaning lot of stuff, erasing links and empty directories, I hope it will not mess my installation, especially by doing the last.
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";doneSimpler 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.