How to loop script for multiple file?

hi, i am running a java script on few thousand files (e1.rnk....en.rnk) but manually,. is there any way to run it automatically by changing the output directory (-out) ?

thanx in advance
ex:

java -jar commands -res /path/e1.rnk -out /path/e1 -gui false
java -jar commands -res /path/e2.rnk -out /path/e2 -gui false
java -jar commands -res /path/en.rnk -out /path/en -gui false

Try:

for i in /path/*.rnk; do java -jar commands -res $i -out ${i%.*} -gui false; done
3 Likes