Tuesday, March 20, 2012

How to delete old backup files by script.


Extended procedure 'xp_delete_file ' is used for to delete the backup files in the server.

We need to specify the file type selected ((0 = FileBackup,1 = File Report),folder path(trailing slash), file extension which needs to be deleted (N'bak'),date(prior which to delete) and folder flag level((1 = include files in first subfolder level, 0 = not) as like below in the Sql Server Management Studio.

EXECUTE master.dbo.xp_delete_file 0, N’D:\SQLBackup',N'BAK',N'06/07/2011 10:18:49',1

By running above script, we can able to delete the old backup files prior to the above specified date.

No comments:

Post a Comment

MYSQL::Setting Validate_Password componet for MySQL Database to ensure password policy settings

Inadequate Password Settings for MySQL Database We observed that the `validate_password%` settings on hostname `<insert hostname>` a...