Bluk creat folders from filename

November 29th, 2013

I got like a lot of files in one folder and I need to move them all in folders with exact file name and since there are about 200-250 files I wondered if someone knows an an app what can do this automated.
Answer #1
I don’t know of any application to do that, it seems like a very strange thing to need. Are you asking, for example, if you had a directory with files:
a.txt
b.txt
c.txt
the application would put them into directories like:
a/a.txt
b/b.txt
c/c.txt
If you are, you could do it with a batch script (save as .bat in the folder with the files and run):
for /f %%a IN ('dir /a-d-h /b *.* ^| findstr /vi .bat$') do mkdir %%~na & move %%a %%~na
If that’s not what you’re asking for don’t run the script above.
Answer #2
This works with any file type? because it’s exactly what I need
Answer #3
Yeah it should do. Warning though, that’s only the second batch script I’ve ever written, run it at your own risk . I’d run it on a copy of the files first (if possible).
Answer #4
It creates the folders but doesn’t move the files. That’s no problem tho, I’m really happy I don’t have to create the folders one by one now
Answer #5
for /f %a IN (‘dir /a-d-h /b *.* ^| findstr /vi .bat$’) do mkdir %~na & move %a %~na
Works from a command line, just copy and paste into a cmd window.
It might not work on long file names..

 

| Sitemap |