Have tried it prompt me with an error:
Object required: 'NameSpace(...)'
Code 800A01A8
my Files are:
sFile1 = "C:\Data1"
sFile2 = "C:\Data2"
sFile3 = "C:\Data3"
These are folders with subfolders and files. Hope you might .
On Sep 17, 8:47 pm, "LJB" <.> wrote:
> It worked for me with a folder of a few small files but seemed to fail with
> large files. I'm not sure why that would be.
>
> LJB
>
> "M P" <mponte...@gmail.com> wrote in message
>
> news:1190012832.184304.147090@o80g2000hse.googlegr oups.com...
>
> > 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.googleg roups.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