@echo off
::三十天以前的文件
set dayago = 30 >$.vbs echo dst_date = date()- %dayago% >>$.vbs echo date_str = right(year(dst_date),4) ^& right("0" ^& month(dst_date),2) ^& right("0" ^& day(dst_date),2) >>$.vbs echo wscript.echo date_str for /f %a in (‘cscript /nologo $.vbs‘) do set dstdate=%a set dstdate=%dstdate:~0,4%/%dstdate:~4,2%/%dstdate:~6,2%
::以上是算出30天以前的日期并格式化为 yyyy/mm/dd
::以当前日期作为zip文件名
set "ymd=%date:~,4%%date:~5,2%%date:~8,2%" set p=d:\test set fn=*.* set c=c:\Program Files\HaoZip pushd %p% md %p%\111 FORFILES /D -%dstdate% /C "cmd /c move @file d:\test\111\" pushd %c% HaoZipC u -tzip %p%\%ymd% /t.zip d:/test/111/*.* rd /s /q %p%\111
时间: 2024-11-08 13:00:25