MkArchive Function:

The MkArchive Function creates a WinZip archive on the server. There are two required arguments: ArchivePath and FilesToArchive. ArchivePath is the absolute path of the zip file to create. ArchivePath should end with ".zip". FilesToArchive is a asterisk (*) delimited list of files to store (compress) in the newly created WinZip archive. You must specify at least one file to zip.

MkArchive requires you to install a free java class file (ZipFunctions.class) onto your server. The installation instructions and java files can be found here. MkArchive returns Null if the required files cannot be found on the server.

string = MkArchive( ArchivePath, FilesToArchive )
Example Usage:
 ' use the FileSystemObject to gather all the files in a folder and 
 ' zip them with MkArchive.

dim objfso, fldr, file, strarc

set objfso = server.createobject("scripting.filesystemobject")

 ' the folder containing everything to zip.
set fldr   = objfso.getfolder( server.mappath( "/aspemporium/codelib/" ) )

 ' seperate each file in the folder with the special delimiter: "*"
for each file in fldr.files
	strarc = strarc & file.path & "*"

 ' remove the last "*"
strarc = left( strarc, len( strarc ) - 1 )

set fldr   = nothing
set objfso = nothing

 ' call MyArchive to zip the above chosen files into 
 ' "" on the server's root.
response.write MkArchive( server.mappath("/"), strarc )
ASP Source Code:
Private Function MkArchive(byVal ArchivePath, byVal FilesToArchive)
	Dim Zip
	On Error Resume Next
	Set Zip = GetObject("java:ZipFunctions")
	If Err Then
		MkArchive = Null
		Exit Function
	End If
	On Error GoTo 0
	MkArchive = zip.ZipFile( FilesToArchive, ArchivePath )
	Set Zip = Nothing
End Function