backuplibreofficebackup-strategies

Libreoffice Multiple Backups?


Is there a way, setting, macro, or otherwise, that can automatically create backups of the current document in a series? Such as, working on a Writer document, pressing a macro button, and creating a backup at that time, so that there is another backup added to the previous backups in a folder?


Solution

  • Well, try this

    Sub createBackUp()
    Dim sURL As String
    Dim aURL As Variant
    Dim saveTime As String
      sURL = ThisComponent.getURL()
      If Trim(sURL) = "" Then Exit Sub  ' No name - cannot store
      saveTime = "_" & FORMAT(Now,"YYYYMMDD\_HHmmSS")
      aURL = Split(sURL, ".")
      If UBound(aURL) < 1 Then  ' No extention?
        sURL = sURL & saveTime
      Else
        aURL(UBound(aURL)-1) = aURL(UBound(aURL)-1) & saveTime
        sURL = Join(aURL,".")
      EndIf
      On Error Resume Next
      ThisComponent.storeToURL(sURL,Array())
      On Error GOTO 0
    End Sub
    

    Also you can try Timestamp Backup