Have tried this one and found working on my requierement. Thanks a
lot.
Btw, another question, how about including subfolders on the zip file?
Is this possible on your provided script?
On Sep 11, 8:23 pm, "LJB" <.> wrote:
> "M P" <> wrote in message
>
> news:1189479273.999620.23430@d55g2000hsg.googlegro ups.com...
>
> >I have C:\Data\*.* and wanting to save it to zip file thru windows
> > script. Is this possible?
>
> This item slightly modified should be able to do it.
>
> http://groups.google.com/group/micro...ng.vbscript/ms...
>
> I'm not sure you can copy all files in a folder at once. You may have to
> loop through them.
>
> I have modified the above somewhat.
>
> Const MyZip = "C:\test.zip"
> Const File1 = "C:\Data\test1.txt"
> Const File2 = "C:\Data\test2.txt"
>
> '-------------- create empty zip file ---------
> CreateObject("Scripting.FileSystemObject") _
> .CreateTextFile(MyZip, True) _
> .Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
>
> '-------------- zip the files ------------------
> With CreateObject("Shell.Application")
> 'add files
> .NameSpace(MyZip).CopyHere File1
> .NameSpace(MyZip).CopyHere File2
> End With
> wScript.Sleep 1000
>
> LJB