Batch file to delete files older than N days

前端 未结 24 2995
没有蜡笔的小新
没有蜡笔的小新 2020-11-21 11:11

I am looking for a way to delete all files older than 7 days in a batch file. I\'ve searched around the web, and found some examples with hundreds of lines of code, and oth

24条回答
  •  没有蜡笔的小新
    2020-11-21 11:38

    For Windows Server 2008 R2:

    forfiles /P c:\sql_backups\ /S /M *.sql /D -90 /C "cmd /c del @PATH"
    

    This will delete all .sql files older than 90 days.

提交回复
热议问题