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

FAQ ID:    FAQ1324
Version:    1.0
Status:    Published
Published date:    03/29/2011


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.

Rate this Page

Please take a moment to complete this form to help us better serve you.

Did this document help answer your question?
If you are finished providing feedback, please click the RATE CONTENT button. Otherwise, please add more detail in the following text box and then click RATE CONTENT.

Your response will be used to improve our document content.

Ask a Question