CMD Command to create folder for each file and move file into folder
- by Tom
I need a command that can be run from the command line to create a folder for each file (based on the file-name) in a directory and then move the file into the newly created folders.
Example :
Starting Folder:
Dog.jpg
Cat.jpg
The following command works great at creating a folder for each filename in the current working directory.
for %i in (*) do md "%~ni"
Result Folder:
\Dog\
\Cat\
Dog.jpg
Cat.jpg
I need to take this one step further and move the file into the folder.
What I want to achieve is:
\Dog\Dog.jpg
\Cat\Cat.jpg
Can someone help me with one command to do all of this?