|
Answer» Hi i have a Batch FILE that does not work . Its meant to RENAME the files to the current date and then copy them to an archive folder
Its not renameing them to the current date
echo off
cd "E:\Projects\Extract Files\ROI\"
Set FileDate=%date:/=%
ren dicbcon.in dicbcon%Filedate_%.in ren dicbdet.in dicbdet%Filedate_%.in ren dicbtot.in dicbtot%Filedate_%.in
copy *.in "E:\Projects\Extract Files\ROI\Archive"
Endecho off for /f "skip=1 tokens=2-4 DELIMS=(-)" %%a in ('echo.^|date') do ( set A=%%a&set B=%%b&set C=%%c) set t=2&if "%date%z" LSS "A" set t=1 for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo.^|date') do ( for /f "tokens=%t%-4 delims=.-/ " %%d in ('date/t') do ( set mm=%%d&set dd=%%e&set yy=%%f)) set DATE1=%dd%-%mm%-%yy% set date2=%yy%%mm%%dd%
i think its help full
put becarful for the date format on the system u USE for eg Thu 03/27/2008 or 03/27/2008 u should fix the code or the date format u got
|