Create folders from filename

October 15, 2010 at 23:43:44
Specs: Windows 7
I’m also looking for something like this, I have a lot of files and I need to create folders from the files name and move the files into the folders, when creating the folders’ names I want to exclude everything after the underscore.

Example:
Files:
abandoned_15342.jpg
abandoned_15343.jpg
abandoned_15344.jpg
hope_14341.jpg
hope_14342.jpg
hope_14343.jpg

Folders:
abandoned
hope

Can somebody help me thanks in advance


See More: Create folders from filename

Report •


#1
October 16, 2010 at 01:57:57
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b/a-d *.jpg') do (
for /f "tokens=1 delims=_" %%f in ("%%~Na") do (
if not exist %%f md %%f
move %%a %%f
)
)


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
October 27, 2010 at 12:38:02
wow man, just wow THANKS A LOT you ROCK

Report •

Related Solutions


Ask Question