Tag Archives: automaticly delete logfiles

Windows Exchange 2010 – Remove log files

Exchange server logfiles can grow very fast!

There are either logfiles in the directory ‘Mailbox Database’ or in ‘Public folder database xxxxxxx’.
I’ve create a .bat file which delete all log files aged 2 days and older:

forfiles -p "C:\Program Files\Microsoft\Exchange Server\V14\Mailbox\Mailbox Database 0258665593" -m E000*.log -d -2 -c "cmd /c del @path"
forfiles -p "C:\Program Files\Microsoft\Exchange Server\V14\Mailbox\Public Folder Database 0449853521" -S -m E01*.log -d -2 -c "cmd /c del @path"

You can copy the code above and make sure the directory suits your environment.
Save it as a .bat file and put in the task manager to run everyday, for example.