I found the message magoo and played with it. I can't seem to get the DIR part to parse the file name in order to create a folder and move the files to the appropriate folders. The following are examples of the files I'm working with:
... 800.1.gif 800.2.gif 800.3.jpg 801.1.gif 801.2.jpg 801.3.gif ...
The package should create folders 800 and 801 and move the files 800.X and 801.X, respectively. I tried FINDSTR and other masks and did not have much luck.
Here is magoo source package code (source: http://bit.ly/1ua8IIF ):
@ECHO OFF SETLOCAL SET "sourcedir=c:\sourcedir" PUSHD %sourcedir% FOR /f "tokens=1*" %%a IN ( 'dir /b /ad "*_*_*-*-* *.*"' ) DO ( ECHO MD %%a ECHO MOVE "%%a %%b" .\%%a\ ) POPD GOTO :EOF
My attempt in a few hours:
@ECHO OFF SETLOCAL SET "sourcedir=c:\sourcedir" PUSHD %sourcedir% FOR /f "tokens=1*" %%a IN ( 'dir /b /ad ^|findstr /r "\.[1-9]"' ) DO ( ECHO MD %%a ECHO MOVE "%%a %%b" .\%%a\ ) POPD GOTO :EOF
I still play with him, but any help would be greatly appreciated!
windows batch-file findstr folders dir
Malibu
source share