| #!/bin/bash |
| |
| # echo "arg: $1"; |
| |
| if [ -z $1 ] |
| then |
| echo " This script requires an argument. " ; |
| exit 1; |
| fi |
| |
| foundDirectory=$1 |
| # should already be in foundDirectory, if execDir used |
| cd $foundDirectory |
| # move up one so we can examine syblings |
| cd .. |
| currentDirectory=`pwd` |
| echo $currentDirectory |
| ndirs=`ls -lA | wc -l` |
| ndirs=$(($ndirs - 1)); # don't count the "totals" line |
| # echo "NDirs: $ndirs" |
| |
| # if only one left, do not remove it, no matter how old |
| if [ $ndirs = 1 ] |
| then |
| exit 0; |
| fi |
| # ok, it is old, and not the only one left |
| rm -fr $foundDirectory |
| |
| |
| |