Demonstration in real time

1. Directory management, zip, unzip and list contents

Examples menu

1. Zipping in ASP

2. Unzipping in ASP

3. Show the contents of a zip file

4. Remove an item of the zip File

5. Zip a whole directory

6. Sample on how to use it on Visual Basic

 Example for zipping:

set ZIP = server.createobject("aspZip.EasyZIP")
Zip.ZipFileName = "c:\inetpub\wwwroot\files\Backup.zip"
Zip.ArgsClear
Zip.ArgsAdd("c:\inetpub\wwwroot\*.asp")
Zip.ArgsAdd("c:\inetpub\wwwroot\*.htm")
Zip.ArgsAdd("c:\inetpub\wwwroot\cgi-bin\*.*")
Zip.Zip
response.Write "Files Zipped=" & Zip.SuccessCNT & " with Error="& Zip.Error
response.Write "Message: " & Zip.LastMessage

 Example for unzipping:

set ZIP = server.createobject("aspZip.EasyZIP")
Zip.ZipFileName = "c:\inetpub\wwwroot\files\Backup.zip"
Zip.ArgsClear
Zip.ArgsAdd("*.*")   'Unzip all files
Zip.UnZip
response.Write "Files Unzipped=" & Zip.SuccessCNT & " with Error="& Zip.Error
response.Write "Message: " & Zip.LastMessage

 Example for showing the contents of a zip file:

set ZIP = server.createobject("aspZip.EasyZIP")
Zip.ZipFileName = "c:\inetpub\wwwroot\files\Backup.zip"
for f = 0 to Zip.GetZipItemsCount - 1
    response.Write Zip.GetZipItem_FIleName( f ) & " "
    response.Write Zip.GetZipItem_CompressedSize( f ) & " " 
    response.Write Zip.GetZipItem_UNCompressedSize( f ) & " "
    response.Write "<br>"
Next

 Example on how to delete an item on the zip file.

set ZIP = server.createobject("aspZip.EasyZIP")
Zip.ZipFileName = "c:\inetpub\wwwroot\files\Backup.zip"
Zip.ArgsClear
Zip.ArgsAdd("c:\inetpub\wwwroot\*.asp")
Zip.RemoveZip

 Example for zipping a full directory:

const AddDirNames = 1
const AddZipTime = 2
const AddRecurseDirs = 4
const AddHiddenFiles = 8
const AddEncrypt = 16
const AddSeparateDirs = 32

set ZIP = server.createobject("aspZip.EasyZIP")
Zip.ZipFileName = "c:\inetpub\wwwroot\files\Backup.zip"
Zip.ArgsClear
Zip.AddOptions = AddDirNames + AddRecurseDirs + AddSeparateDirs
Zip.ArgsAdd("c:\inetpub\wwwroot\*.*")
Zip.Zip
response.Write "Files Zipped=" & Zip.SuccessCNT & " with Error="& Zip.Error
response.Write "Message: " & Zip.LastMessage

 Example using Visual Basic:
  Thanks to Uwe Heinz

Private Sub Command1_Click()

Dim Zip As New aspZIP.EASYZIP

Zip.OnStartPage Nothing
Zip.ZipFileName = "c:\temp\test.zip"
Zip.ArgsClear
Zip.ArgsAdd "m:\vwsm.mdb"
Zip.Zip
Zip.OnEndPage
Debug.Print Zip.Error
MsgBox "zipped"

Zip.OnStartPage Nothing
Zip.ZipFileName = "c:\temp\test.zip"
Zip.ArgsClear
Zip.ArgsAdd "vwsm.mdb"
Zip.ExtrBaseDir = "c:\temp"
Zip.UnZip
Debug.Print Zip.Error
Zip.OnEndPage
MsgBox "unziped"

End Sub

Note: You must set a reference on AspZip in VB, if you don't find it on the list, you must add the DLL to the reference list. See documentation on VB to see how you can add references to your project.