for section in $sections; do for genre in $genres; do cd "$glroot$section" if [ -d "$genre" ]; then cd "$genre" for dirs in `ls -al | tr -s ' ' '^' | grep "^l"`; do release="`echo "$dirs" | cut -d '>' -f2 | cut -d '^' -f2`" symlink="`echo "$dirs" | cut -d '^' -f8`" if [ "$1" = "debug" ]; then echo "Deleting DIR: $glroot/site/$release" echo "Deleting SYM: $glroot$section/$genre/$symlink" echo "" else rm -rf "$glroot$release" unlink "$glroot$section/$genre/$symlink" fi done fi done done