Batch file to delete files older than N days

前端 未结 24 2491
没有蜡笔的小新
没有蜡笔的小新 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:39

    You might be able to pull this off. You can take a look at this question, for a simpler example. The complexity comes, when you start comparing the dates. It may be easy to tell if the date is greater or not, but there are many situations to consider if you need to actually get the difference between two dates.

    In other words - don't try to invent this, unless you really can't use the third party tools.

提交回复
热议问题