@echo off
;/P 路径
;/M 文件类型
;/D 时间 + | - +:之后 - :之前 example:-200 200天之前的数据
;/C command命令
FORFILES /P path: /M *.bak /D -7 /C "cmd command @file"
example:
FORFILES /P e:\ /M *.bak /D -7 /C "cmd /c del /F /s /q @file"
删除e:下,7天前,文件名为*.bak的文件
转载于:https://blog.51cto.com/3403658/895560