Manage Learn to apply best practices and optimize your operations.

Detaching And Unzipping Files

In our company we are using GROUP-TOOLS for Mail-Blocking and
virus protection.
The Group-Tools can handele a lot of Command-line Tools to scan
mails for viruses.
All these tools needs viruspattern-files.
In our case it's NAI which needs *.dat files
Well, how to distribute these DAT-Files to our locations
(we have 85 Domino Servers all over Europe)

I created a MAIL-IN Database and replicated it to all
servers where the Virus scan process runs.
The agent below has to be run on newly arrived mail
and will detach any attached ZIP-File to a temporay
directory and unzip the ZIP-File to a target directory.

Pls don't hesitate to contact me if you have any trouble
with the code.
Maybe you send me an email if you find the code useful;
or you spend me a beer (if we ever meet).
At least you deside, whether the code is email- or beerware.
Feel free to use it.
'DetachFileAndUnzip:

'// ==================================================
'// C L A S S "UnzipFile"
'// ==================================================
'// written 05/2000 by Ulrich Krause
'// Lotus Notes Development
'// Sch?ller Holding, Germany
'// ukrause@schoeller.de
'//
'// Uses the file "unzip.exe" by INFO-ZIP
'// I did not tested but I'm quit shure that you
'// could use any other commandline unz-Tool
'//
'// copy this Class to the declaration-section
'// of the agent or view-action
'// because of the use of API-Calls it will only work
'// in an Windows environment
'// ==================================================

Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type

Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type

Const NORMAL_PRIORITY_CLASS = &H20&
Const INFINITE = -1&

'// Options for unzip.exe
'// for more options see the documentation of "unzip.exe"
Const QUIETMODE = " -qq " ' do not show
messages
Const OVERWRITE = " -o " ' overwrite
existing files
Const NEVER_OVERWRITE = " -n " ' never overwrite
existing files
Const REFRESH = " -f " ' freshen
existing file, create none
Const UPDATE = " -u " ' update
files, create if necessary
Const ZIPINFO = " -Z -t " ' Summary
of Zip-File
Const ZIPINFO_VERBOSE = " -Z -2 -t " ' Like ZIPINFO
including FileNames
Const ZIPINFO_FILE = "~ZIPINFO.TMP" ' File containing
ZIP-Informations

'// Some Windows-API for the ShellAndWait sub
Declare Function WaitForSingleObject Lib "kernel32" (Byval hHandle As Long,
Byval dwMilliseconds As Long) As Long
Declare Function CreateProcessA Lib "kernel32" (Byval lpApplicationName As
Long, Byval lpCommandLine As String, Byval lpProcessAttributes As Long, Byval
lpThreadAttributes As Long, Byval bInheritHandles As Long, Byval
dwCreationFlags As Long, _
Byval lpEnvironment As Long, Byval lpCurrentDirectory As Long, lpStartupInfo As
STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Declare Function CloseHandle Lib "kernel32" (Byval hObject As Long) As Long

Class UnzipFile

Private ExeFile As String
Private ExtractTo As String
Private FilesToExtract As String
Private UnzipOptions As String

Declare Public Sub New(UnzipExe As String, ExtractFilesTo As String)
Declare Private Function IsPathAvailable(path As String) As Variant
Declare Private Function IsDriveAvailable(drivNam$) As Variant
Declare Public Function Unzip(Files As String, Options As String)
Declare Public Function ZipInfo(Files As String)
Declare Private Sub ShellAndWait(Byval RunProg As String)
Declare Public Property Get Executable As String
Declare Public Property Set Executable As String
Declare Public Property Get TargetPath As String
Declare Public Property Set TargetPath As String

Sub New (UnzipExe As String, ExtractFilesTo As String)
'// Constructor
ExeFile = UnzipExe
dummy = IsPathAvailable(ExtractFilesTo)
ExtractTo = ExtractFilesTo
End Sub

Public Property Get Executable As String
Executable = ExeFile
End Property

Public Property Set Executable As String

Dig Deeper on Domino Resources - Part 3

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close