Is there any command that I can use to find the broken links that point to non-existent files?
Thanks a lot.
Ioannis Vranos wrote:
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:
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:
[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)