Often we need to do daily backups for client Access Databases. This can be a little irritating to do it every day so we made this little script that allows it to run on the server automatically. There are a couple of components that you would need to run this. Firstly you are going to need to have a server where you can say run this asp file automatically. Secondly you are going to need the XStandard.Zip component. BTW, if your server can’t run this automatically you can still run this manally, or you can set your computer to open the backup url automatically via Task Scheduler.

I normally make a file called backup.asp and have this inside the file, this will backup all mdb files in one directory.

<%@LANGUAGE=”VBSCRIPT” CODEPAGE=”65001″%>

<% temp_date = Year(Date) & “_” & Month(Date) & “_” & Day(Date) %>

<%
Dim objZip
Set objZip = Server.CreateObject(“XStandard.Zip”)
objZip.Pack “C:\path-to-file-you-want-to-backup\*.mdb”, “C:\path-to-where-you-want-to-backup-to\” & temp_date & “.zip”
Set objZip = Nothing
%>

If you want to backup only one file then use this.

<%@LANGUAGE=”VBSCRIPT” CODEPAGE=”65001″%>

<% temp_date = Year(Date) & “_” & Month(Date) & “_” & Day(Date) %>

<%
Dim objZip
Set objZip = Server.CreateObject(“XStandard.Zip”)
objZip.Pack “C:\path-to-file-you-want-to-backup\database-name.mdb”, “C:\path-to-where-you-want-to-backup-to\” & temp_date & “.zip”
Set objZip = Nothing
%>

This will make a zip file that has this format : yyyy_mm_dd.zip or something like this 2010_6_14.zip

Hope that helps.

About Paul Ogier

Paul Ogier has written 202 posts.

Paul Ogier is an IT Guru, Website Developer, and generally a nice guy. He loves code and he loves design.

Incoming search terms for the article: