Need to move lots of consistently named files to certain folders (Windows 7) -
i need populate bunch of folders files of various types.
the destination folder structure follows
year > committee_name year > year month committee_name
ex: 2015 > adp 2015 > 2015 january adp
the files moved in folders committee (mom, adp, etc.). have organize first year, committee, month.
each folder contains files of various types named date , committee (ex: word document adp meeting of jan 22, 2015 "012215adp.doc").
i somehow automate populating of these folders there hundreds if not thousands of files move.
my programming experience in matlab, proficient in, not allowed use due corporate rules.
i know how execute , modify .bat files, not know enough make them.
@echo off setlocal enabledelayedexpansion set "destination=c:\path\that\contain\destination\folders" rem change current folder 1 contain mom, adp, etc. folders cd "c:\path\to\committees\folder" rem create array of month names (i.e. month[01]=january, etc.) set i=100 %%a in (january february march april may june july august september october november december) ( set /a i+=1 set "month[!i:~1!]=%%a" ) rem process committee folders /d %%d in (*) ( rem process files in folder cd "%%d" %%f in (*.*) ( rem format of file name is: "mmddyycom.ext" set "filename=%%~nf" set "mm=!filename:~0,2!" set "yy=!filename:~4,2!" set "com=!filename:~6,3!" rem move file proper destination folder %%m in (!mm!) set "dest="%destination%\20!yy!\!com! 20!yy!\20!yy! !month[%%m]! !com!" if not exist "!dest!" md "!dest!" move "%%f" "!dest!" ) rem go parent folder , pass next committee folder cd .. )
Comments
Post a Comment