| Simple backup script (VBS) |
|
|
| VB Script |
|
1. Create an archive of my files 2. Delete the archive after a period of time A. To create an archive, we'll use RAR archiver. It can be downloaded from http://www.rarlab.com/download.htm. After you install this application, copy the file rar.exe (found in C:\Program Files\WinRAR) to C:\Windows. This way you can run rar.exe from anywhere on the system and it will find it. For the purpose of this tutorial we'll use: Expiration date: 15 days (so we keep the backups for 2 weeks) Backup path (Destination): C:\backups Files that are being backed up (Source): C:\inetpub\wwwroot (IIS websites)
Firstly, the script will create an archive file with a date embedded (so it will be in the format: backup-10-4-2011.rar for a backup that was created on October 4th, 2011) Then it runs the external tool, rar.exe, where it adds files to the newly created archive Finally, it checks in the backup directory for files older that 15 days and deletes them. Update: Thanks JK - fixed the errors.
|
| Last Updated on Friday, 07 October 2011 13:35 |


Dim OutputFile MyDate = Replace(Date, "/", "-")
and
OutputFile = "backup-" & mydate & ".rar" Set objShell = WScript.CreateObject("WScript.Shell")
Gives an error when running