I recently made use of this command myself and thought it might be helpful for others. Here’s a really easy way to create folders for a bunch of files. I used it for a load of writing I had done. I needed to organise all of the pieces into their own folders but having over 50 files, I didn’t want to create new folder – type the name – move the file, for each one.
So I used this instead.
Open up notepad on your pc. Easiest way is to press the windows key and start typing notepad. It will appear in the list.
Then, copy and paste the text below.
@echo off
for %%i in (*) do (
if not “%%~ni” == “folders” (
md “%%~ni” && move “%%~i” “%%~ni”
)
)
Done that? Right. Now save the file as folders.bat
Place this file in any folder containing the files you want to add a folder to. Then double click it to run. Any files in that folder will instantly get their own folder, named the same as the file. Be aware that this means any file, so maybe move out any files you don’t want to have its own folder.
Simple as that. Hope this helped!