(view source code of xzipdemo.vbs as plain text)
Option Explicit
Zip "C:\boot.ini", "C:\testzip.zip"
UnZip "C:\testzip.zip", "D:\", "*.ini"
Function Zip( myFileSpec, myZip )
' This function uses X-standards.com's X-zip component to add
' files to a ZIP file.
' If the ZIP file doesn't exist, it will be created on-the-fly.
' Compression level is set to maximum, only relative paths are
' stored.
'
' Arguments:
' myFileSpec [string] the file(s) to be added, wildcards allowed
' (*.* will include subdirectories, thus
' making the function recursive)
' myZip [string] the fully qualified path to the ZIP file
'
' Written by Rob van der Woude
' http://www.robvanderwoude.com
'
' The X-zip component is available at:
' http://www.xstandard.com/page.asp?p=C8AACBA3-702F-4BF0-894A-B6679AA949E6
' For more information on available functionality read:
' http://www.xstandard.com/printer-friendly.asp?id=C9891D8A-5390-44ED-BC60-2267ED6763A7
Dim objZIP
On Error Resume Next
Err.Clear
Set objZIP = CreateObject( "XStandard.Zip" )
objZIP.Pack myFileSpec, myZip, , , 9
Zip = Err.Number
Err.Clear
Set objZIP = Nothing
On Error Goto 0
End Function
Function UnZip( myZip, myTargetDir, myFileSpec )
' This function uses X-standards.com's X-zip component to extract files from a ZIP file.
'
' Arguments:
' myZip [string] the fully qualified path to the ZIP file
' myTargetDir [string] the directory where the extracted files will be located
' myFileSpec [string] the file(s) to be extracted, wildcards allowed
'
' Written by Rob van der Woude
' http://www.robvanderwoude.com
'
' The X-zip component is available at:
' http://www.xstandard.com/page.asp?p=C8AACBA3-702F-4BF0-894A-B6679AA949E6
' For more information on available functionality read:
' http://www.xstandard.com/printer-friendly.asp?id=C9891D8A-5390-44ED-BC60-2267ED6763A7
Dim objZIP
On Error Resume Next
Err.Clear
Set objZIP = CreateObject( "XStandard.Zip" )
objZIP.UnPack myZip, myTargetDir, myFileSpec
UnZip = Err.Number
Err.Clear
Set objZIP = Nothing
On Error Goto 0
End Function
page last modified: 2024-04-16; loaded in 0.0051 seconds