- @echo off
- set SrcDir=F:\201221test\smppbillstore
- for /f "tokens=1,2,3 delims=- " %%i in ("%date%") do set DstDate=%%i%%j%%k
- for /f %%a in ('"dir /b %SrcDir%\"') do (
- if "%%~na" leq "%DstDate%" (
- set "FolderDate=%%~na"
- set "FolderDate=%FolderDate:~0,7%"
- if "%FolderDate%" leq "%DstDate%" (
- cd %SrcDir%
- if exist %%a (
- echo rd /s /q "%%a"))))
- pause
复制代码 改了一下上面的代码~~~~蛋疼了我就是用提取日期删除非今日文件 就是
set "FolderDate=%FolderDate:~0,7%"
if "%FolderDate%" leq "%DstDate%"
这二个不知道为什么读不到%%A值蛋疼了~~不然就可以了~~~ |