How do I purge or remove old access log files to maintain free space on a Reporter server?
search cancel

How do I purge or remove old access log files to maintain free space on a Reporter server?

book

Article ID: 166158

calendar_today

Updated On:

Products

Reporter

Issue/Introduction

The following command can be used on Windows Server 2003 and 2008 operating systems to delete access log files older than a given amount of days:

 

forfiles.exe /p C:\<log dir> /s /m *.* /d -180 /c "cmd /c del /q @path"

 

In the example above, all log files older than 180 days will be deleted.  You can alter the command argument after the "/d" option to any desired number of days.  Furthermore, substitute "<log dir>" for the actual directory where your logs are located.  To automate this process, create a text file containing the above command, then change its file extension to .CMD.  At this point the built-in Windows task scheduler can be used to run the command as often as desired.

NOTE:  forfiles.exe is a part of the Windows Resource kit.  If this file does not exist on your Windows 2003/2008 server, please install the Windows Resource Kit for your version of Windows.