Batch file to delete files older than N days

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

    forfiles /p "v:" /s /m *.* /d -3 /c "cmd /c del @path"
    

    You should do /d -3 (3 days earlier) This works fine for me. So all the complicated batches could be in the trash bin. Also forfiles don't support UNC paths, so make a network connection to a specific drive.

提交回复
热议问题