Overview
The DNN debugging creates log files automatically, which can be useful to troubleshoot different issues. However, log files can grow in size quickly and take a lot of disk space. This article aims to demonstrate how to create a scheduled task in Windows to delete the old DNN log files automatically.
Prerequisites
Server administrator credentials
Process
- Log in to the site server as an administrator.
- Launch the Task Scheduler.
- In Windows, click Start.
- Type
Task Scheduler
. - Press Enter.
- Right-click on the Task Scheduler Library and select New folder.
- Enter a name for the new folder and click OK.
- Right-click on the newly created folder and click Create Task.
- In the Name field, enter a name for the task.
- Enable the Run whether user is logged on or not option.
- Go to the Triggers tab and click New Trigger.
- From the Begin the task drop-down menu, select On a schedule.
- Under the Settings section, select the frequency to run the task.
- Click OK.
- Go to the Actions tab and click New.
The default action is to Start a program. If it is not already selected, make sure to select it from the Action drop-down menu. - Enter
ForFiles
into the Program/script text box.
ForFiles is a computer software utility for Microsoft Windows, which selects files and runs a command on them. - In the Add arguments field, specify the argument that you want to pass to the ForFiles script. Depending on your specific needs, modify the argument below by replacing the [path to log files] and the [days] placeholders:
/p "[path to log files]" /s /d -[days] /c "cmd /c del @file"
The sample argument that is presented below removes files older than 90 days from theC:\DBA\SQLTrace
folder.
/p "C:\DBA\SQLTrace" /s /d -90 /c "cmd /c del @file"
- In the Create Task window, click OK.
Confirmation
The task is displayed in the list.
Comments
0 comments
Article is closed for comments.