Wednesday, February 06, 2013

Using ForFiles.exe to kick ass !!!

When working with Exchange 2010 server and seeing the log files taking up space on your c: drive. I implemented the following using forefiles.exe to resolve the issue.

First make sure you have forfiles.exe installed. Mine was in the default location of C:\Windows\System32.

I noticed log files were getting to be a problem on (Exchange) server and in C:\inetpub\logs\LogFiles\W3SVC1 there were many older log files taking up space.

So I initiated the following from an elevated DOS command prompt:

Forfiles.exe /p C:\inetpub\logs\LogFiles\W3SVC1 /s /m u*.log /d -30 /c "cmd /c del @file"

Yes you need to use "quotes" when using the cmd command

This basically deleted files in this directory older than 30 days. You can also assign this to run as a task weekly / monthly etc.

Technet site which explains commands and usage in better detail

http://technet.microsoft.com/en-us/library/cc753551(WS.10).aspx

Hope this helps someone>

biz


0 Comments:

Post a Comment

<< Home