Delete files older than xxx

dwjongbloeddwjongbloed Posts: 30
edited January 17, 2008 11:43AM in SQL Backup Previous Versions
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"' :?:


:?: :?: :?: :?:

Comments

  • The ERASEFILE = 1 means it will delete any files older than 24 hours. Maybe they were created the day before, but aren't over 24 hours old?

    You could try using ERASEFILES = 23h to delete any files older than 23 hours for example.
    Helen Joyce
    SQL Backup Project Manager
    Red Gate Software
  • I ran the job this morning at 9:02 am and there was a file out there creeated on 1/15/08 at 7:13 pm and it didn't get delted. It is well over the 24 hrs from when it was created. Any idea why this would be happening?
Sign In or Register to comment.