1 #!/bin/sh 2 # 3 # Copyright 2000, 2003 by The XFree86 Project, Inc 4 # 5 # Remove dangling symlinks and empty directories from a shadow link tree 6 # (created with lndir). 7 # 8 # Author: David Dawes <dawes (at] xfree86.org> 9 # 10 # $XFree86: xc/config/util/cleanlinks.sh,v 1.2 2003/04/15 03:05:16 dawes Exp $ 11 12 find . -type l -print | 13 ( 14 read i 15 while [ X"$i" != X ]; do 16 if [ ! -f "$i" ]; then 17 echo $i is a dangling symlink, removing 18 rm -f "$i" 19 fi 20 read i 21 done 22 ) 23 24 echo Removing empty directories ... 25 #find . -type d -depth -print | xargs rmdir > /dev/null 2>&1 26 find . -type d -depth -empty -print -exec rmdir {} \; 27 exit 0 28