you could do all of this in vbscript
'lastrun.vbs - check for vbs lastrun and rename a folder if less than 7d
f=".\testfolder"
with createobject("scripting.filesystemobject")
if not .folderexists(f) then wsh.echo f, "not exist":wsh.quit 1
lastrun=now
if .fileexists(".\dummy.txt") then lastrun=.getfile(".\dummy.txt").datelastmodified
wsh.echo "Last run:",lastrun
if datediff("d",now,lastrun)<7 then
d=.getbasename(f) & "_" & right(year(date)*10000+month(date)*100+day(date),6)
wsh.echo "Less than 7 days, rename to", d
.getfolder(f).name = d
end if
set dummy=.opentextfile(".\dummy.txt",2,true)
dummy.writeline now
dummy.close
end with
to run, type at command prompt "lastrun.vbs"
use cscript engine: cscript//nologo lastrun.vbs
use wscript engine: wscript//nologo lastrun.vbs
or if you insist on batch code, i've the pure batch code which is twice the size of vbs code.
or you could have the best of both world with the above code by devcom