The following script deletes .bak files older than 7 days from F:SharesBackup2Disk
DECLARE @DeleteDate datetime
SET @DeleteDate = DateAdd(day, -7, GetDate())
EXECUTE master.sys.xp_delete_file 0,N’F:SharesBackup2Disk’,N’bak’,@DeleteDate,1
The following script deletes .bak files older than 7 days from F:SharesBackup2Disk
DECLARE @DeleteDate datetime
SET @DeleteDate = DateAdd(day, -7, GetDate())
EXECUTE master.sys.xp_delete_file 0,N’F:SharesBackup2Disk’,N’bak’,@DeleteDate,1