Batch converting .img files to .mgz in FreeSurfer I have a series of .img files from a previous analysis in SPM that Freesurfer (FS) cannot directly handle. 

FS comes with a conversion tool, the mri_convert command, but I am not able to make it run iteratively over all the files in the same directory. I found a mention about the --sdcmlist argument online, however I am not figuring out the proper syntax for it.

When I run:

mri_convert --sdcmlist 000123_1_4.img 000123_1_4.mgz


I get:

mri_convert: missing output volume name


Would anyone suggest a way of going about these conversions?
I couldn't find a way of doing that using the arguments in the mri_convert, so I decided to do it programatically in bash. This answer will only work in Linux (or in any bash). It's an one-line command to iterativelly run the convertion on all files in the same directory.

for f in *.img; do mri_convert $f $f.mgz; done


There is one aspect that I did not get right, that is FS actually handles img files, however these files do not have directionality information, thus using them is not recommended. 

One can simply feed the recon-all command with the img file and the command will take care of the conversion.