I have researched this quite a bit - and while there appears to be some documentation out on the web (especially on Stackoverflow), I find that it's hard to understand what the programming is doing. In other words, I really want to learn.
My Problem: Six (6) different files with a consistent naming convention come in to my computer daily. They all land in the same "received" folder. Each file has its own respective sub-folder and each one of those sub-folders has all twelve (12) month folders with-in it (So 6 x 12 = 72 sub-folders). I want to double click my batch file daily such that it will direct each file (with its consistent naming convention) to its respective folder AND to the correct month folder within that respective sub-folder. I'm hoping it will use the "created on" date property to route each file to its proper location.
Note*: The directory architecture is the following: The landing folder includes the six (6) sub-folders. My date/time format is: day mm/dd/yyyy 12:00 PM
Here is some of the code I have created so far, but I'm stuck:
For %%x in ('Receive folder Path') do set datetime=%%~tx
:dissect_date_time
for /f "tokens=1-5 delims=/: " %%a in (1%) do set day=%%a&set month=%%b&set
call :dissect_date_time
:MoProc
if %month% == "01" set asd="Jan"
if %month% == "02" set asd="Feb"
if %month% == "03" set asd="Mar"
if %month% == "04" set asd="Apr"
if %month% == "05" set asd="May"
if %month% == "06" set asd="Jul"
if %month% == "07" set asd="Jul"
if %month% == "08" set asd="Aug"
if %month% == "09" set asd="Sep"
if %month% == "10" set asd="Oct"
if %month% == "11" set asd="Nov"
if %month% == "12" set asd="Dec"
IF EXIST "Landing Directory\*US233*" (
goto :MoProc
move /-y "Landing Directory\*US233*" "Landing Directory\Standard\*%asd%\"
)
IF EXIST .... next remaining files ...
goto :EOF
In the above code, I've only listed one (1) possible candidate file. Really appreciate any help/thoughts anyone has.