Error with foreach command when merging files

Hi!
This will be a super basic question but I am not sure why I am getting this error (below) or how to fix it?
I am trying to convert a folder of .dcm files (blipUp) into one .mif file per individual. I am running this code from from the subjects directory:

foreach * : mrconvert IN/PRE_DWI_A-P_DIST_CORR_64_MDDW IN/AP.mif
[WARNING] For input "001" (returncode = 1):
         mrconvert: [ERROR] unknown format for image "001/022_-_001_DWI_A-P_DIST_CORR_64_MDDW"
         mrconvert: [ERROR] error opening image "001/022_-_001_DWI_A-P_DIST_CORR_64_MDDW"
[WARNING] For input "001" (returncode = 1):
         mrconvert: [ERROR] unknown format for image "001/001_DWI_A-P_DIST_CORR_64_MDDW"
         mrconvert: [ERROR] error opening image "001/001_DWI_A-P_DIST_CORR_64_MDDW"

I am not sure what is causing it as the code runs successfully when I change the folder names. Does anyone have any idea what is causing this? I’d like to know for future reference.

Thank you in advance! Lilly

I think the issue is likely to be that it’s unlikely that PRE will catch the correct prefix here. It might be easier to use regular pattern matching within the command part of the call, e.g.:

foreach * : mrconvert IN/*_DWI_A-P_DIST_CORR_64_MDDW IN/AP.mif

Thanks so much! PRE was the issue.