if [ -d ../RPMS ] ; then cd ../RPMS else if [ -d ../../RPMS ] ; then cd ../../RPMS else echo "RPMS directory does not exist" exit fi fi for i in *.rpm; do if [ -f $i ] ; then continue # echo "$i is there"; else echo "$i is not there "; rm $i fi; done