Looping through certain files in a folder and running command on them while and also change the file name : <p>beginner here. I want to write a simple script for use in the bash terminal, but I don't know how to make it. The gist is that I have a folder filled with different files, some .foo, some .bar, etc. I want to create a script that takes all the .foo files and perform a command on them, but in the same line rename them so that the output file is named file.baz. </p>

<p>For example:
command -i file.foo -o file.baz for all .foo files in a directory.</p>
