[dba-Tech] Today's files

Tope Mike Mike.Tope at saipem.com
Mon Jun 1 11:26:36 CDT 2015


It can be done without Winzip. You need this little script as zip.vbs (thankyou Google):-
'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.

regards
Mike

-----Original Message-----
From: dba-Tech [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of John R Bartow
Sent: 01 June 2015 17:14
To: 'Discussion of Hardware and Software issues'
Subject: Re: [dba-Tech] Today's files
Importance: High

Hi Mike,
That's nice.

I was wondering if this could be done using Windows Explorer compression
(zip) utility.

John B

-----Original Message-----
From: dba-Tech [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of
Tope Mike
Sent: Monday, June 01, 2015 8:57 AM
To: 'Discussion of Hardware and Software issues'
Subject: Re: [dba-Tech] Today's files

Vbscript gives us date arithmetic. This is just two lines, run it in a DOS
box with cscript scriptname.vbs:-

Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.run "cmd /k forfiles /s /d " & dateadd("d",-1,date()) & " /c ""cmd
/c if @isdir==FALSE 0x22%ProgramFiles%\Winzip\Winzip32.exe0x22 -a
lastday.zip @file"""

regards
Mike

-----Original Message-----
From: dba-Tech [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of
Arthur Fuller
Sent: 01 June 2015 12:48
To: Discussion of Hardware and Software issues
Subject: Re: [dba-Tech] Today's files

Thanks, Mike.

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

> In windows:-
> Forfiles takes a date argument
> Or maybe xcopy /d /s /l
>
> regards
> Mike Tope
_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com
****************************************************************************
**************
CONFIDENTIALITY NOTICE
This e-mail and any attachment are confidential and may be privileged or
otherwise protected from disclosure. It is solely intended for the person(s)
named above. If you are not the intended recipient, any reading, use,
disclosure, copying or distribution of all or parts of this e-mail or
associated attachments is strictly prohibited. If you are not an intended
recipient, please notify the sender immediately by replying to this message
or by telephone and delete this e-mail and any attachments permanently from
your system.

_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com


_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com
******************************************************************************************
CONFIDENTIALITY NOTICE
This e-mail and any attachment are confidential and may be privileged or otherwise protected from disclosure. It is solely intended for the person(s) named above. If you are not the intended recipient, any reading, use, disclosure, copying or distribution of all or parts of this e-mail or associated attachments is strictly prohibited. If you are not an intended recipient, please notify the sender immediately by replying to this message or by telephone and delete this e-mail and any attachments permanently from your system.



More information about the dba-Tech mailing list