> the protogenLabs notebook » reading full entry…

Dec
13

Move old IIS logs or any files using this handy script!

» posted 3600 days ago @ 03:11 PM by George Merlocco in technology

Over the many years that I have been administering Windows Servers, one of the most forgotten and cumbersome tasks is to properly manage the log files that servers generate. Hosting websites and other services often generate many .log files which can grow to immense sizes. Recently this had happened to me, and I was looking for a method/script to run through a directory I point it to, and move all log files older than a certain date to my other partition.

After a bit of hunting around on the net, I eventually came across this GREAT script that uses the Windows Script Host to do exactly what I wanted. The script was developed by pforret, and is available for download at the end of this post. The current version of WaRmZip.wsf is v1.7. Below is a listing of a few functions that it is capable of:

waRmZip.wsf v1.7 (Nov 2005)

Utility to clean up/free up space in a folder (and its subfolders):

  • compressing files after a certain number of days (with external program)
  • rotating files after a certain number of days/above a certain size
  • deleting files and/or empty folders after a certain period of time
  • moving files to other folders/disks

As an example, here is the command I typed to move all files older than 30 days into my LogFileArchive folder on D:

cscript waRmZip.wsf "C:\Windows\System32\LogFiles" /r /ma:30 /md:"D:\LogFileArchive\$YEAR\$COMP\IIS"

waRmZip Readme  (click to show/hide)

Enjoy this great utility!

Download the .zip archive:

download file  waRmZip.zip - (9.44kB)
downloadedThis file has been downloaded 2971 times.

comments 5 comments submitted  article's permanent link permalink  hop to the top^ back to top
article tags article tags: ,   Bookmark and Share

> Leave a comment? [5] article comments…

1

Used the log script you had here… worked perfect! Thank You.

by Elton on 02.24.2011 @ 07:25 PM » #

2

hi

what command to issue when creating an empty log file after rotation? what is the /rn value?

by Candy on 09.08.2011 @ 03:10 AM » #

3

Hi,I am having an issue in moving log files such has file.log.1,file.log.2 and so on…I tried to move using .log.* still its not moving..

by ANTONY on 10.12.2011 @ 08:43 AM » #

4

Sir,

I have downloaded this file.After that how to delete the files.
My OS is Windows server 2003

Requirement is
1.I want to move log files from 1 folder to another folder
2.before moving the file,the file has to be archived and then moved
3.After movement,the file in the source location should be deleted.

Please help me on this.

Thanks.
Sandeep

by Sandeep on 12.17.2011 @ 11:04 PM » #

5

Amigos, estou tentando executar o script e indenpendente da opção ele retorna o seguinte erro:

***STDERR:2

by Danilo on 02.03.2012 @ 08:08 AM » #

> leave a comment?

Name:


E-Mail:


Website:


Comment: