Create folders based on filename

Redpill

Solid State Member
Messages
19
Hey again guys,

Just a quick request. I've spent a couple hours searching the net for a batch file (or similar) that can create folders based on the file names in a directory and then move those files into the folders, e.g.

Root Folder
- File A
- File B

Becomes:
Root Folder
- Folder A (File A inside)
- Folder B (File B inside)

I want to retain the filenames as the folder names but don't need the extension on the folders. I did stumble across something so close to perfect it hurts but unfortunately, doesn't work if the filenames contain spaces. Anybody here good with batch files? :)

Closest i've found is the command line:
For %J in (Your_Folder\*.*) Do @(MD %~dpnJ & move %J %~dpnJ)

Works perfect... except if the filenames have spaces :\
Could anyone give us a hand?

If it matters, I'm moving about 300 files - mostly video.
 
Fixed my own problem :p

Ran a free batch rename program that I have to replace all spaces with underscores then re-ran the above batch file and wham! Worked perfect. Re-ran the batch rename program after to rename the folders and filenames back to spaces.

Long live freeware! :cool:
 
Back
Top Bottom