Win10 LO7.1.2.2 HSQL2.51
Hi,
I have a backup routine where one specifies the destination via a textbox, once the button is clicked the backup is generated locally or on a mapped network drive or usb.
All working fine. However I only want to retain the last backup and as such need to delete the previous one.
Thats were I am stuck as a- the path is a variable and b- the filename is timestamped.
Any thoughts how I can clear an existing backup before creating a new one? The backups subfolder may contain backups of different databases all having a prefix before the timestamp.
If not FileExists(sPathURL) Then
Msgbox "specified drive or destination not connected "
exit sub
end if
sPath = ConvertFromURL(sPathURL)
sName = ThisDatabaseDocument.Title
iLen = InStr(sPath, sName)
rem sPath = Left(sPath, iLen-1)
strSQL = "BACKUP DATABASE TO " & “’” & sPath & “” & “Backups’ BLOCKING NOT COMPRESSED”
oConnection = oDoc.CurrentController.ActiveConnection
oStmt = oConnection.createStatement()
oStmt.execute(strSQL)
Dim sVar as Integer
sVar = MsgBox(“Respaldado con éxito” ,64,“MPQ”)
Call lbu()
thanks