本帖最后由 apang 于 2013-3-5 21:07 编辑
压缩创建日期最早的100个文件- @echo off
- set "rar=C:\Program Files\WinRAR\WinRAR.exe"
- set "pth=%~p0"
- wmic datafile where "drive='%~d0' and path='%pth:\=\\%' and extension='log'" get CreationDate,Name>$
-
- for /f "tokens=1*" %%a in ('sort $') do (
- if /i not "%%a"=="CreationDate" (
- set /a "n+=1,1/(101-n)" 2>nul||(del $&goto :eof)
- "%rar%" a -afzip -agYYYYMMDDHH -ibck "F:\baklog\test_log_" "%%~nxb"
- )
- )
复制代码
|