Delete files older than xxx
dwjongbloed
Posts: 30
I have a SQL job that is running the follwing T-SQL statement. However when it is run it is not deleting the prior day(s) files. Is it because I am doing an <Auto> on the name?
EXECUTE master..sqlbackup N'-SQL "BACKUP DATABASE [DW_Data_Mart] TO DISK = ''D:\MSSQL\Backups\DW_Data_Mart\<AUTO>.sqb'' WITH COMPRESSION = 1, ERASEFILES = 1, INIT"' :?:
:?: :?: :?: :?:
EXECUTE master..sqlbackup N'-SQL "BACKUP DATABASE [DW_Data_Mart] TO DISK = ''D:\MSSQL\Backups\DW_Data_Mart\<AUTO>.sqb'' WITH COMPRESSION = 1, ERASEFILES = 1, INIT"' :?:
:?: :?: :?: :?:
Comments
You could try using ERASEFILES = 23h to delete any files older than 23 hours for example.
SQL Backup Project Manager
Red Gate Software