Backup script:
@ Echo off
Echo date: % date %
@ Set stryear = % date :~ 0, 4% & set strmonth = % date :~ 5, 2% & set strday = % date :~ 8, 2%
Echo time: % time %
@ Set strhh = % time :~ 0, 2% & set strmm = % time :~ 3,2% & set strss = % time :~ 6, 2%
@ Set strdatetime = % stryear % strmonth % strday % strhh % strmm % strss %
@ Md "web_backup _ % stryear % strmonth % strday % strhh % strmm %"
@ Xcopy "E: \ www "/e/c" web_backup _ % stryear % strmonth % strday % strhh % strmm % \ ">" web_backup _ % stryear % strmonth % strday % strhh % strmm % \ web_backup_policstryear?#strmonth=#strday=#strhh##strmm=.txt"
Delete script:
@ Echo off
@ Del G: \ web_backup \ *. log/f/s/a/q
@ Set srcdir = G: \ web_backup
> "% Srcdir % \ getdate. vbs" echo dt = date ()-7
> "% Srcdir % \ getdate. vbs "echo x = right (year (dt), 4) ^ & right (" 0 "^ & month (dt), 2) ^ & right ("0" ^ & day (dt), 2)
> "% Srcdir % \ getdate. vbs" echo wscript. echo x
@ For/f % a in ('cscript/nologo "% srcdir % \ getdate. vbs" ') do set dateflag = %
@ Set dateflag = % dateflag :~ 0, 4%-% dateflag :~ 4,2%-% dateflag :~ 6, 2%
@ For/f "tokens = *" % a in ('dir/B/ad "% srcdir % "') do (if "% a" lss "web_backup _ % dateflag % 000" (rd/s/q "% srcdir % \ % "))
Author: "linux"