I'm trying to create a .bat file that does this: for any file that arrives into C:/Input the bat file creates a subfolder in C:/Folders that has the name of that file, like this: File XYZ.txt arrives into C:/Input and the bat file creates a subfolder in C:/Folders/ so it appears as C:/Folders/XYZ.txt/ and then copies xyz.txt file fron C:/Input into C:/Folders/XYZ.txt/ so it appears like this: C:/Folders/XYZ.txt/xyz.txt Someone provided this, I ran it unsuccessfully. What am I missing? Thanks. @echo off set input=c:\input set folders=c:\folders for /F "delims=. tokens=1" %%i in ('dir %input%\*.* /A-D /B') Do ( md %input%\%%i md %folders%\%%i move %input%\%%i.* %folders%\%%i