CANVEXT=".canv" PNGEXT=".png" CANVPATH="canvas/" PNGPATH="render/" cd $CANVPATH for FILE in `ls *$CANVEXT | sed -e 's/'$CANVEXT'$//'` do ../bin/Debug/AwesomeAttractor -c ../$CANVPATH$FILE$CANVEXT 3200 3200 3 ../$PNGPATH$FILE$PNGEXT #Do other stuff with file done