I have a folder with a bunch of .avi and .wav files. Their names are as follows:
{NameX}_{DateX}
I need an expression that creates folders called {Name1}
, {Name2}
, etc, and then copies the respective files into those folders.
Thanks in advance!
Edit: Sorry, here's what I tried so far.
@ECHO OFF
SETLOCAL
SET "sourcedir=c:\sourcedir"
PUSHD %sourcedir%
FOR /f "tokens=1*" %%a IN (
'dir /b /a-d "*_*_*_*_*_*_*_*.avi"'
) DO (
MD %%a
MOVE "%%a %%b" .\%%a\
)
POPD
GOTO :EOF
It didn't work though, and I don't know why.
Here's a concrete filename, I think it might help.
hl2_2014_12_26_04_05_12_268.avi