Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Windows periodically deletes log files N days ago under the specified path

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The content of the bat script file under Windows is

1. Delete all files 5 days ago under the specified path

.

Echo offset SrcDir=E:\ WORK\ Gitset DaysAgo=5forfiles / p% SrcDir% / s / m *. * / d -% DaysAgo% / c "cmd / c del / f / Q / a @ path" 2. Delete all log files under the specified path 5 days ago @ echo offset SrcDir=E:\ WORK\ Git / / specified path: 5 days ago set DaysAgo=5 / / 5 days ago forfiles / p% SrcDir% / s / m * .log / d -% DaysAgo% / c "cmd / c del / f / Q / a @ path"

* .log is a filtered file format. If you delete a file in jpg image format, you can replace it with .jpg.

3. Windows runs bat files regularly

1) in the WIN10 system, select computer Management-"system tools -" Task Scheduler to create a task

2) in the pop-up "create Task" box, set it in General.

3) in the trigger-- "New, and set the time point and frequency of the scheduled operation."

4) operate-"New -" open the written bat script file, and click OK to save

Then return to the computer management interface, the system tool-"Task Scheduler -" Task Scheduler can be found in the "scheduled automatic deletion" task.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report