I'm guessing you are trying to do a recursive search for a directory called .thumbnails in the current directory and then removing it? I, personally, would probably do something more akin to: ---- Start simple bash script ---- #!/bin/bash DIRECTORY_NAME=".thumbnails" find . -name $DIRECTORY_NAME -type d -prune -exec rm -rf {} \; ---- End simple bash script ---- -name $DIRECTORY_NAME this is the name to match, this *is* case sensitive. If you want it case insensitive use -iname -type d matches directories only -prune one directory matched don't try to go further down that tree -exec rm -rf {} \; remove that particular directory tree Just a little shorter than your version ;) Cheers, Brett
DIRECTORY=".thumbnails"
remThumbs() { rm -rf $DIRECTORY }
for i in `ls -a` ; do if [ -d $i ] ; then echo "Yup, $i is a directory" if [ $i == $DIRECTORY && $i != "." || $i != ".." ] ; then echo "Removing $i ..." # remThumbs else echo "Entering $i ..." cd $i $HOME/bin/remThumbnails fi else echo "Nope, $i is a file" fi done
--
Thanks,
Andrew.
_______________________________________________ alug, the Anglian Linux User Group list Send list replies to alug@stu.uea.ac.uk http://www.anglian.lug.org.uk/ http://rabbit.stu.uea.ac.uk/cgi-bin/listinfo/alug See the website for instructions on digest or unsub!