Options

Different Purge Dates for Local Drive and Network Shares?

spc_kevinspc_kevin Posts: 3
Not sure if this is possible...

If I am backing up to a Local drive and a network share I'd like them to have different purge intervals. make sense? In other words, I'd like to keep my backups on local drives for 14 days but, on network shares for 30 days.

Doable?? :lol:

Thanks,

Comments

  • Options
    peteypetey Posts: 2,358 New member
    It is currently not possible to specify location dependent purge dates.

    I will log it for the decision makers to decide if it should be included in a future version. If anybody else has ever needed this feature, please do post a comment here, so that we get an idea of how useful this feature would be. Thanks.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • Options
    I think it would be very useful.
  • Options
    This would be extemely useful for us as well. Currently I wrote a script to do the second delete for us.
  • Options
    Thanks for the answer. Yes, I think it would be very useful.

    In the mean time, I added an ActiveX Script Step to the red gate backup job that checks the local drive for .sqb files older than 14 days. and removes them and set my backup job to retain files up to 30 days. That should work for now.
    Option Explicit
    on error resume next
     Dim oFSO
     Dim sDirectoryPath
     Dim oFolder
     Dim oFileCollection
     Dim oFile
     Dim iDaysOld
    
     iDaysOld =14
     Set oFSO = CreateObject("Scripting.FileSystemObject")
     sDirectoryPath = "F:\Redgate_SQL_Backup"
     set oFolder = oFSO.GetFolder(sDirectoryPath)
     set oFileCollection = oFolder.Files
    
     For each oFile in oFileCollection
      if Right(oFile.Name,4) =".sqb" Then
             If oFile.DateLastModified < (Date() - (iDaysOld-1)) Then
              oFile.Delete(True)
    
             End If
      End if
     Next
    
     Set oFSO = Nothing
     Set oFolder = Nothing
     Set oFileCollection = Nothing
     Set oFile = Nothing
    
  • Options
    In 5.3 there is now a new keyword ERASEFILES_REMOTE which allows this functionality.

    "Deletes all SQL Backup files for the database that are older than the specified number of days (or hours), and are located on a network share. You use this argument if you want to specify different deletion intervals for local files and files located on network shares. If not specified, SQL Backup uses the ERASEFILES value."

    As explained in the help file: http://help.red-gate.com/help/SQLBackup ... ACKUP.html
    Helen Joyce
    SQL Backup Project Manager
    Red Gate Software
Sign In or Register to comment.