I would like to create folders from a prefix of certain file then copy multiple files with a certain string in their file name to that folder. For example:
VI files to a folder called DM0008 with the following files
DM0008d3VI_001.IMI
DM0008d3VI_002.IMI
MI files to a folder called DM0008MI with the following files
DM0008d6MI_002.IMI
DM0008d6MI_003.IMI
I did try this but this created a folder for each individual file:
@echo off
for %%a in (*VI*) do (
md "%%~na" 2>nul
move "%%~na.*" "%%~na"
)
for %%a in (*MI*) do (
md "%%~na" 2>nul
move "%%~na.*" "%%~na"
)