[AccessD] Archiving files with Winzip Command Line version

Mcgillivray, Don [ITS] donald.a.Mcgillivray at mail.sprint.com
Wed Mar 9 14:53:28 CST 2005


Sorry, can't do that either . . .

Maybe I should more fully describe what this system is doing. 

Nutshell version (much detail excluded for the sake of clarity):

The system monitors folders on three remote servers - West coast,
Midwest, and East coast.  Taking each server in turn, the system detects
text files with specific characteristics, logs their appearance to a
table of tracking records, FTPs them to a local server, and deletes the
originals from the remote server.  Data from the transferred files is
then loaded to a temp table and a series of summaries is produced from
the data, with the results being pushed into tables for each type of
summary.  When complete, the tracking record is updated to reflect the
completion, and the transferred files are zipped to an archive named for
the date they were archived (yyymmdd.zip).  The name of the archive file
is then written to the file's tracking record so the file can be easily
retrieved if necessary.  Then, the files are deleted from the local
server.  This system monitors the remote servers 24 x 7 and processes
over 20,000 files per month, ranging in size from 0 bytes to 15
megabytes.  Finished zip files range in size from 1 to 80 megabytes,
with the average falling somewhere around 30.

Needless to say, a given zip file may contain hundreds of large files by
the end of the day, and the overhead of un-zipping and re-zipping each
time I want to add a file would bring the rest of the system to its
knees.  The system has been functioning very well for the last six
months, but yesterday a brief outage on the server that holds the
archives illustrated the risk of not validating the successful
completion of the zip stage.  (All other destructive actions are
deferred until the safety of the data has been verified.)

Unless I can come up with a reliable way to validate a successful zip, I
may have to content myself with testing for connectivity to the archive
server before and after writing to it, assuming that whatever happens in
between is probably OK.

Any other idears out there?


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Wednesday, March 09, 2005 11:59 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Archiving files with Winzip Command Line version


Why not unzip the archive to a temp folder, add the files you want and
then rezip the whole thing?

Charlotte Foust


-----Original Message-----
From: Mcgillivray, Don [ITS]
[mailto:donald.a.Mcgillivray at mail.sprint.com] 
Sent: Wednesday, March 09, 2005 11:03 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Archiving files with Winzip Command Line version


Andy,

That would work, except that in actual practice I'm *adding* files to an
existing archive, named according to the date the files are added to it.
So, the zip may legitimately exist before starting the archive, and I
can't kill it.

Thanks for the input, though.

Cheers!
Don

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
Sent: Wednesday, March 09, 2005 10:37 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Archiving files with Winzip Command Line version


Don
You could use Dir in a loop to test for the zip existing. You'd have to
Kill the file before too. Then set a time limit and drop out of the loop
if the zip still didn't exist after that time.

-- Andy Lacey
http://www.minstersystems.co.uk 

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> Mcgillivray, Don [ITS]
> Sent: 09 March 2005 17:41
> To: AccessD
> Subject: [AccessD] Archiving files with Winzip Command Line version
> 
> 
> Hello, All
> 
> In my app I'm archiving text files via VBA using the Winzip
> command line and the ShellWait function I got from Dev 
> Ashish's web site.  It works well, but I need to be able to 
> validate that the zip succeeds before moving on to the next 
> step in my code.  I've been experimenting with a sample I 
> found that uses the Windows Script Host.  Passing my Winzip 
> command line string to it causes the process to hang.  (The 
> same string passed to ShellWait works in a flash.)  I tried 
> it using a command line string for "Blat" to send a test 
> email, and that worked as expected - no hang.  A code sample 
> is below.  Am I overlooking something?  Has anybody a better 
> solution for this requirement?
> 
> Thanks!
> 
> Don
> 
> Function GetErrorLevel()
>   Dim wsShell As Object, Proc As Object, strCommand As
> String, strErrLevel As String
>   Dim strZipFileName As String, strTargetFile as String, 
> strWinzipPath as String
>   
>   strWinzipPath = "C:\Archive\Winzip\WZZIP"
>   strZipFileName = "C:\Archive\TestZipFile.zip"
>   strTargetFile = "C:\Data\DM02TEST.txt"
> 
>   strCommand =  strWinzipPath & " -a " & """" &
> strZipFileName & """" & " " & """" & strTargetFile & """"
> 
>   'Testing command line using ShellWait
>   'ShellWait strCommand, vbHide
>   
>   Set wsShell = CreateObject("wscript.shell")
>   Set Proc = wsShell.Exec(strCommand)
> 
>   Do While Proc.Status = 0
>      DoEvents 'Yields execution so that the operating system
> can process other events
>   Loop
> 
>   'Use proc.ExitCode to check for returned %errorlevel%
>   strErrLevel = "StdOut=" & Proc.StdOut.ReadAll()
>   strErrLevel = strErrLevel & Chr(13) & Chr(10) & "ExitCode="
> & Proc.ExitCode
> 
>   MsgBox (strErrLevel)
> 
>   Set wsShell = Nothing
>   Set Proc = Nothing
> 
> End Function
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list