jg
Mon Feb 20 01:08:07 CST 2006
or you get download 7-zip from sourceforge.net and use it's command line
options
quick simple and easy
"jort777" <jort777.22xsxo@mail.codecomments.com> wrote in message
news:jort777.22xsxo@mail.codecomments.com...
>
> Paul Gee wrote:
>> *Did you ever get this to wrk, using the code supplied with the
>> suggested tweaks I'm getting the zip file produced but then receiving
>> an error message "Cannot create or replace SinkFolder: There is
>> already a file with the folder name you specified. Specify a
>> different name." Tried removing the zip, renaming still get the same
>> message. I'm trying to use this method within a DTs packgae in SQL. *
>
> I used the script from Philip (not sure who posted it first) and it
> works perfectly on my system.
>
> The question now is ... How can I add a password to it?
>
> =======================================
> To make sure we talk about the same script, this is the one I used:
>
> Option Explicit
>
> Const ForReading = 1, ForWriting = 2, ForAppending = 8
>
> Dim MySource, MyTarget, MyZipName, MyHex, MyBinary, i
> Dim oShell, oApp, oFolder, oCTF, oFile
> Dim oFileSys
>
> MySource = "c:\WUTemp"
> MyTarget = "c:\SinkFolder.zip"
>
> MyHex = Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0)
>
> For i = 0 To UBound(MyHex)
> MyBinary = MyBinary & Chr(MyHex(i))
> Next
>
> Set oShell = CreateObject("WScript.Shell")
> Set oFileSys = CreateObject("Scripting.FileSystemObject")
>
> 'Create the basis of a zip file.
> Set oCTF = oFileSys.CreateTextFile(MyTarget, True)
> oCTF.Write MyBinary
> oCTF.Close
> Set oCTF = Nothing
>
> Set oApp = CreateObject("Shell.Application")
>
> 'Copy the files to the compressed folder
> Set oFolder = oApp.NameSpace(MySource)
> If Not oFolder Is Nothing Then
> oApp.NameSpace(MyTarget).CopyHere oFolder.Items
> End If
>
> 'Wait for compressing to begin, this was necessary on my machine
> wScript.Sleep(5000)
>
> 'wait for lock to release
> Set oFile = Nothing
> On Error Resume Next
> Do While (oFile Is Nothing)
> 'Attempt to open the file, this causes an Err 70, Permission Denied
> when the file is already open
> Set oFile = oFileSys.OpenTextFile(MyTarget, ForAppending, False)
> If Err.number <> 0 then
> Err.Clear
> wScript.Sleep 3000
> End If
> Loop
>
> Set oFile=Nothing
> Set oFileSys=Nothing
>
>
>
> --
> jort777
> ------------------------------------------------------------------------
> Posted via
http://www.codecomments.com
> ------------------------------------------------------------------------
>