http://www.sqlservercentral.com/blogs/practicalsqldba/2012/02/27/how-to-setup-a-task-to-delete-the-old-backup-files-or-log-files-from-the-server-/ Printed 2017/08/20 12:22AM
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!