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 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
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
I 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.
On Mon, Jan 28, 2008 at 02:22:53AM +0200, Ioannis Vranos alleged:
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
I 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.
On your entire OS? Sounds like a pretty good way to break things.
Garrick Staples wrote:
I 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.
On your entire OS? Sounds like a pretty good way to break things.
Yes it damaged it. I had to reinstall from scratch... Any pretty way to find broken links on the entire filesystem would be welcome however.
Ioannis Vranos ha scritto:
Garrick Staples wrote:
I 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.
On your entire OS? Sounds like a pretty good way to break things.
Yes it damaged it. I had to reinstall from scratch... Any pretty way to find broken links on the entire filesystem would be welcome however.
try fslint (rpmforge repository)
Regards
Lorenzo Quatrini
Ioannis Vranos wrote:
Garrick Staples wrote:
I 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.
On your entire OS? Sounds like a pretty good way to break things.
Yes it damaged it. I had to reinstall from scratch... Any pretty way to find broken links on the entire filesystem would be welcome however.
How about:
find . -L -type l -ls
then after you have evaluated them and they are all good to purge,
find . -L -type l -exec rm -f {} ;
-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.
Hi,
Any pretty way to find broken links on the entire filesystem would be welcome however.
I have a script available for this:
#!/bin/bash # command line parameter would be the directory to search
for i in ` find $1 -type l `; do # feststellen, ob der link noch gueltig ist oder nicht file $i | grep -q broken if [ $? -eq 0 ] ; then echo "Broken link $i" fi done exit
Christian Volker
Technical Support Engineer
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.
On Sun, 2008-01-27 at 21:45 -0500, Ross S. W. Walker wrote:
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?
[U] app-misc/symlinks Available versions: 1.2 1.2-r2 Installed versions: 1.2(10:39:15 11/10/05)(-static) Homepage: http://www.ibiblio.org/pub/linux/utils/file/ Description: Symlinks scans for and fixes broken or messy symlink
symlinks: scan/change symbolic links - v1.2 - by Mark Lord
Usage: symlinks [-crsv] dirlist
Flags: -c == change absolute/messy links to relative -d == delete dangling links -r == recurse into subdirs -s == shorten lengthy links -v == verbose (show all symlinks)