Home | History | Annotate | Line # | Download | only in dist
      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 
     11 find . -type l -print |
     12 (
     13 	read i
     14 	while [ X"$i" != X ]; do
     15 		if [ ! -f "$i" ]; then
     16 			echo $i is a dangling symlink, removing
     17 			rm -f "$i"
     18 		fi
     19 		read i
     20 	done
     21 )
     22 
     23 echo Removing empty directories ...
     24 #find . -type d -depth -print | xargs rmdir > /dev/null 2>&1
     25 find . -depth -type d -empty -print -exec rmdir {} \;
     26 exit 0
     27