How to delete files older than x days with FORFILES?

落花浮王杯 提交于 2019-12-25 04:41:28

问题


OS: Windows Server 2008 R2

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

Command:

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

Error:

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

Does anybody know what is wrong?


回答1:


Remove the ending backslash in the /P argument



来源:https://stackoverflow.com/questions/26295850/how-to-delete-files-older-than-x-days-with-forfiles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!