Windows periodically cleans up specified directory files (keeps logs for specified days)
1. Edit del60day.bat script and add the following:
Replace the specified directory and time according to actual needs, and only keep all files in the D:\DBbak directory for the last seven days.
#del60day.bat file forfiles /p "D:\DBbak" /s /m *.* /d -60 /c "cmd /c del @path"#clean.bat file forfiles /p "E:\tmp\LocalUser\jda" /s /m *.* /d -30 /c "cmd /c del @path"
save and exit
2. Join windows regular scheduling tasks
In win system, select Computer Management-> System Tools-> Task Scheduler to create a task
Configure the three pages of General, Trigger and Operation as required, as follows:
2.1, Configure General page, where the Runner is specified: Execute script regardless of whether the user is logged in or not
2.2 Configure Trigger page, specify script execution time schedule
2.3, configuration operation page, specify the written script
Click OK after all configurations are complete: