James
Fri Mar 21 13:45:14 CDT 2008
"Jeff C" <JeffC@discussions.microsoft.com> wrote in message
news:B16EFC9B-9A5F-4070-B95E-0E6F157C7CF3@microsoft.com...
> Does anyone have a method of zipping more than one file into one
> compressed
> file? I am trying to combine several report files into one so I can then
> execute command line switches for Outlook to schedule emails. I have the
> command line working but Outllok will not attach more than one file with
> this
> method.
>
> Any other ideas?
Jeff, my suggestion would be to use the cabarc.exe command line utility from
Microsoft to create a cabinet archive of your reports. Cabarc is a free
download from Microsoft. You can get it inside the very small (463KB)
'Microsoft Cabinet SDK' at
http://support.microsoft.com/kb/310618. There is
a newer version (not sure of the difference) inside the 'Windows XP Service
Pack 2 Support Tools'. The download is larger (4.7 MB), but the version is 4
years newer. In both cases, if you have WinZIP or WinRAR on your computer,
you can extract cabarc.exe without needing to install anything or actually
execute the downloaded file. The 'Windows XP Service Pack 2 Support Tools'
can be found at (watch for wrapping):
http://microsoft.com/downloads/details.aspx?familyid=49ae8576-9bb9-4126-9761-ba8011fabf38
Cabinet files offer several advantages over zip files with a few small
disadvantages. The compression is much better (when using LZX), the utility
is free & cabinet archives are supported natively in Windows from Windows
98 - Windows Vista. If you have WinZIP installed with it's default options,
cabinet archives will appear and work like zip files. The disadvantages are
that cabinet compression is much slower than zip (but on small documents you
would probably not notice it) and the archives are solid, so you cannot
simply add or remove files from an existing archive. You have to extract it
and then recreate the archive with your changes.
To compress your files, you can put cabarc.exe (cabinet.dll might also be
required) in the %path% of the directory with your script. Something like
this should work:
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim oWSH, sSrcDir, sArchive
sSrcDir = "C:\Documents to compress"
sArchive = "C:\Archive.cab"
Set oWSH = CreateObject("WScript.Shell")
If Not Right(sSrcDir, 1) = "\" Then sSrcDir = sSrcDir & "\"
oWSH.Run "cabarc.exe N """ & sArchive & """ """ & sSrcDir & "\*.*", 0, True
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~