Afficher un message
Vieux 11/09/2007, 13h23   #2
LJB
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Windows Script that will Save Files to ZIP file


"M P" <mponteres@gmail.com> 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...c?dmode=source

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


  Réponse avec citation
 
Page generated in 0,05090 seconds with 9 queries