Thanks for your response but the script is kinda complicated. I have
found the previous post which is much simpler.\
On Sep 11, 10:19 pm, "McKirahan" <N...@McKirahan.com> wrote:
> "M P" <mponte...@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?
>
> Here's the URL of a scriptable zip program: http://www.7-zip.org/
>
> Will this ?
>
> Option Explicit
> '*
> '* Declare Variables
> '*
> Const cVBS = "7z.vbs"
> Const cEXE = "7z.exe"
> Const cFOL = "C:\Data\*.*" '= path of files to zip
> Const cBAT = "7z_.bat"
> Const cZIP = "7z_.zip"
> Const cTXT = "7z_.txt"
> Const cLOG = "7z_.log"
> '*
> '* Declare Variables
> '*
> Dim strDIR
> strDIR = WScript.ScriptFullName
> strDIR = Left(strDIR,InStrRev(strDIR,"\"))
> Dim intFIL
> intFIL = 0
> Dim strFIL
> Dim strFOL
> strFOL = Replace(cFOL,"*.*","")
> '*
> '* Declare Objects
> '*
> Dim objCTF
> Dim objFIL
> Dim objFSO
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Dim objGFO
> Dim objOTF
> Dim objWSS
> '*
> '* Delete Files
> '*
> If objFSO.FileExists(strDIR & cTXT) Then
> objFSO.DeleteFile(strDIR & cTXT)
> End If
> If objFSO.FileExists(strDIR & cBAT) Then
> objFSO.DeleteFile(strDIR & cBAT)
> End If
> If objFSO.FileExists(strDIR & cLOG) Then
> objFSO.DeleteFile(strDIR & cLOG)
> End If
> If objFSO.FileExists(strDIR & cZIP) Then
> objFSO.DeleteFile(strDIR & cZIP)
> End If
> '*
> '* Identify Files
> '*
> Set objOTF = objFSO.OpenTextFile(strDIR & cTXT,2,True)
> Set objGFO = objFSO.GetFolder(strFOL)
> Set objFIL = objGFO.Files
> For Each strFIL in objFIL
> objOTF.WriteLine(strFOL & strFIL.Name)
> intFIL = intFIL + 1
> Next
> Set objFIL = Nothing
> Set objGFO = Nothing
> Set objOTF = Nothing
> '*
> '* Create Batch File
> '*
> Set objCTF = objFSO.CreateTextFile(strDIR & cBAT,true)
> objCTF.WriteLine(cEXE & " a " & cZIP & " @" & cTXT & " >> " & cLOG)
> objCTF.WriteLine(cEXE & " l " & cZIP & " >> " & cLOG)
> Set objCTF = Nothing
> '*
> '* Run Batch File
> '*
> Set objWSS = CreateObject("WScript.Shell")
> objWSS.Run "%comspec% /C " & cBAT,7,True
> Set objWSS = Nothing
> '*
> '* Destroy Objects
> '*
> Set objFSO = Nothing
> '*
> '* Finish Message
> '*
> MsgBox intfil & " files zipped.",vbInformation,cVBS