Using VBScript to Create Dated Backups with 7-Zip

Posted on .

I needed a simple method to backup a small folder using 7-Zip on a regular basis without installing extra software. I wanted to be able to leave it running daily and have it remove old backups.

I chose VBScript to complete this task, re-learning a few things from the last time I used the language.

The script shall backup C:\Customer to S:\Backup\backup_DATE.7z. It will also delete old backups, only keeping the first 5. The directories and number of kept backups are variables, check the code comments.

Download
  backup-folder.vbs (3.4 KiB, 3,237 hits)

4 thoughts on “Using VBScript to Create Dated Backups with 7-Zip

  1. Anonymous

    Bug in zeropad function:

    ‘ No printf() in VBScript it seems
    Function ZeroPad(int, length)
    If Len(int) < length Then
    ZeroPad = Right(String(length, "0") & int, length)
    End If
    End Function

    should be

    ' No printf() in VBScript it seems
    Function ZeroPad(val, length)
    If Len(val) < length Then
    ZeroPad = Right(String(length, "0") & val, length)
    Else
    ZeroPad = val
    End If
    End Function

    Reply

Leave a Reply

You may leave the Name and Email fields blank to post anonymously.