windows - Batch script - files to folders - with addition -
i'm working in company has far many (millions) of record forms need organising.
each file uses following naming structure: xxxxx-xx-xx-xxxxx
e.g. 43144-02-40-21324.<ext>
i've used in past batch script puts files folder of same name, i'm looking different.
i'd end following folder structure:
c:\[root directory]\43144\02\40\21324.pdf
is possible? knowledge of batch scripts non existant, have ability throw together?
thanks in advance, david
@echo off setlocal set "sourcedir=." set "destdir=u:\temp" /f "tokens=1,2,3,*delims=-" %%a in ('dir /b/a-d "%sourcedir%\*-*-*-*"') ( md "%destdir%\%%a\%%b\%%c" 2>nul if exist "%destdir%\%%a\%%b\%%c\%%d" (echo "%destdir%\%%a\%%b\%%c\%%d" exists ) else ( move "%sourcedir%\%%a-%%b-%%c-%%d" "%destdir%\%%a\%%b\%%c\%%d" >nul ) ) goto :eof
this should set on right track - need set source , destination directories...
Comments
Post a Comment