本帖最后由 lky216 于 2013-4-30 16:05 编辑
回复 25# terse
文件夹 PATH 列表
卷序列号为 E094-8C28
C:.
│ 1.txt
│
└─user
│ 新建 文本文档.txt
│
├─liky
│ │ 新建 文本文档.txt
│ │
│ ├─doc
│ └─log
│ ex20130430.log
│
└─wxh
│ 新建 文本文档.txt
│
├─doc
│ 新建 文本文档.txt
│
└─log
ex20130430.log
代码 | @echo off | | setlocal enabledelayedexpansion | | set "fd=20130501000000" | | set "d=c:" | | set "p=\user\" | | set "ext=log" | | for /f "tokens=*" %%p in ('dir /b /ad "%d%%p%"') do ( | | for /f "skip=1 tokens=1*" %%i in ('wmic datafile where "drive='%d%' and path='%p:\=\\%%%p\\log\\' and FileName | | | | like 'ex%%' and extension='%ext%'" get name^,LastModified') do ( | | for /f "tokens=1,2* delims=. " %%a in ("%%i %%j") do ( | | if "%%a" lss "%fd%" echo del "%%~fc" | | ) | | ) | | ) | | pauseCOPY |
echo结果 | del "c:\user\liky\log\ex20130430.log" | | del "c:\user\wxh\log\ex20130430.log" | | 请按任意键继续. . .COPY |
可以了,去掉echo也可以了,谢谢。
当初显示和删除不一样。。。
标记下,日后回报。
另外,每N个客户如果没有日志文件的话,就会回显一行 无可用范例
把del的文件,echo保存为deldate.txt日志咯? |