A couple of handy scripts that can be used for IIS Logs, Backup Logs and Firewall Logs etc
Please test before deploying to Live, if you put in the wrong folder you could damage your operating system!
- Firstly open a command prompt and type forefiles, if you get a file list it’s installedm if you don’t then download the Windows 2000 Resource Kit.
- Copy the below into notepad and save as Delete_old_data.bat and amend the folder (y:) and the amount of days old to delete (30).
[sourcecode language=”css”]# Delete files older than 30 days from the y: including any files inside folders
forfiles /P y: /S /M *.* /C "cmd /c del @FILE" /d -30
# Delete folders older than 30 days from the y:
forfiles /P y: /M *.* /C "cmd /c if @ISDIR==TRUE RMDIR /Q /S @PATH" /d -30[/sourcecode]
Now run the new file :0)