SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

How to setup a task to delete the old backup files or log files from the server ?

Cleaning up the servers disks on daily basis is very important task for smooth functioning of servers.We have seen many times our report servers went down  and database backup failed due to the lack of disk space.
It is a tedious task to log in to the servers and delete the old files manually on regular basis. It will be more tedious if you need to manage more servers.The below VB script will help you to schedule the clean up job using a Windows Task Scheduler.


This VB script will help to remove files from the folders which is older than the retention days mentioned in the function call.Now this can be scheduled to run on specified schedule using windows task manager. The account in which this task is scheduled should have full security right on the folders to perform this task. The VB script file is downloadable at  http://dl.dropbox.com/u/64219284/PracticalSQLDba/CleanUpfolder.vbs

Hope this will help you to save lot of time!


I have total of 11 years of IT experience with Application development, Database Development and Database Administration. I have worked with different version of SQL server from 7.0 to 2008.Started my carrier as VB ,VC++ and database developer in a banking sector for implementing their core banking solution. Currently working as Database Administrator with wide knowledge in performance tuning, high availability solution, troubleshooting and server monitoring. This blog is my humble attempt to share my knowledge and what I learned from my day to day work.


Leave a comment on the original post [www.practicalsqldba.com, opens in a new window]

Loading comments...