[dba-Tech] Today's files

Arthur Fuller fuller.artful at gmail.com
Mon Jun 1 18:00:06 CDT 2015


On Mon, Jun 1, 2015 at 9:26 AM, Tope Mike <Mike.Tope at saipem.com> wrote:

> 'Get command-line arguments.
> Set objArgs = WScript.Arguments
> InputFolder = objArgs(0)
> ZipFile = objArgs(1)
>
> 'Create empty ZIP file.
> CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile,
> True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
>
> Set objShell = CreateObject("Shell.Application")
>
> Set source = objShell.NameSpace(InputFolder).Items
>
> objShell.NameSpace(ZipFile).CopyHere(source)
>
> ' Wait for compression window to open
> set scriptShell = CreateObject("Wscript.Shell")
> Do While scriptShell.AppActivate("Compressing...") = FALSE
>    WScript.Sleep 500 ' Arbitrary polling delay
> Loop
>
> ' Wait for compression to complete before exiting script
> Do While scriptShell.AppActivate("Compressing...") = TRUE
>    WScript.Sleep 500 ' Arbitrary polling delay
> Loop
>
> And I called it using a variation on this:-
> cscript.exe /nologo c:\space\zip.vbs <folder to zip> <targetzipfile>.zip
> Note that that zips a whole folder into a compressed folder, so the
> forfiles command wants to just copy the files there beforehand.
>
> You probably also want to name the zip file using the date - the
> possibilities are endless.
>

Way cool, Mike. You're bringing back memories of when I released my first
product, Artful.Lib, whose installation was totally done with a batch file
that accepted several args and if not supplied, went with default args.
Wow, that was 1988, a long time ago. And nowadays we have PowerShell to
make everything a tad more spiffy, but in essence it's the same old game.
Thanks a lot for your help, Mike.

Arthur


More information about the dba-Tech mailing list