如何使用FORFILES删除超过x天的文件? [英] How to delete files older than x days with FORFILES?

查看:173
本文介绍了如何使用FORFILES删除超过x天的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

操作系统:Windows Server 2008 R2

OS: Windows Server 2008 R2

我有一个小的批处理文件,该文件应删除特定文件夹中所有超过x天的备份.

I've got a small batch file which should delete all backups older than x days in a specific folder.

命令:

forfiles /P "C:\LehrerOffice_Backup\BatchBackup\" /S /M *.* /D -31 /C "cmd /c del @PATH" 

错误:

Invalid argument/option - '@PATH'. Type "forfile /h" for usage

有人知道怎么了吗?

推荐答案

删除/P参数中的反斜杠

Remove the ending backslash in the /P argument

这篇关于如何使用FORFILES删除超过x天的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆