ATTREXT=".attr" CANVEXT=".canv" ATTRPATH="attr/" CANVPATH="canvas/" cd $ATTRPATH for FILE in `ls *$ATTREXT | sed -e 's/'$ATTREXT'$//'` do ../bin/Debug/AwesomeAttractor -a ../$ATTRPATH$FILE$ATTREXT 500 ../$CANVPATH$FILE$CANVEXT 800 600 3 #Do other stuff with file done cd .. zip -r canvae.zip $CANVPATH*$CANVEXT