• Hi in this case my date format used in backup file getutcdate() format but

    to delete files i am using this script

    Declare @sql varchar(250),@retention tinyint

    set @retention=0

    set @sql='Exec master.dbo.xp_cmdshell ''Del E:\SQL2005\Backup\*' + convert(varchar(15),getdate()-@retention,120) + '*.bak'''

    Exec (@sql)

    i also tried with getutcdate()

    but it gives the following error.

    Could Not Find \\E:\SQL2005\Backup\*2008-04-03*.bak

    why i donot understand.

    can any one give heads up.