Re: unzipping file and overwritting old file...



mjs wrote:
thank you....

and i was looking to only use the OS's features...(i.e., no outside sources)

???

thank you.

"dot" <"tsr(at)tpg(dot)com(dot)au" wrote:

mjs wrote:
unzipping file and overwritting old file...

i would like to have a script that unzips a zipped file and when a previous file exists, to overwrite this file (without human response)...?

???

thank you.

I have successfully used Molezip. http://devtools.teggo.com/molezip/

Function UnzipFile (ZipSourceFile , ZipContentFile, DestFile)
'This function uses molezip to unzip a single file. Molezip is very
'basic and cannot overwrite existing files. It 'might'
'work with wildcards but hasn't been tested.
Set fso = CreateObject("Scripting.FileSystemObject")
Set Mzip = CreateObject("MoleZip.ZipFile")
MZip.Open ZipSourcefile, True
'Delete the old file first or Molezip will silently fail
If fso.FileExists(DestFile) Then
Set aFile = fso.GetFile(DestFile)
aFile.Delete
End If
'Extract the file.
MZip.Extract ZipContentFile, DestFile
Mzip.Close
UnzipFile = "File Extracted"
End Function

TSR

In WinMe and later Explorer handles compressed files via zipfldr.dll. Unfortunately I haven't been able to find anyone who has successfully scripted it so I had to use an external control. I also have a SAP server where it wasn't possible to install a control so I have used
the freeware Infozip and its companion Unzip from a shell:

Set WshShell = CreateObject("WScript.Shell")

ZipFile


Sub ZipFile
' MsgBox "Starting Zip"
ret=WshShell.Run("zip.exe -r -j c:\test1.zip C:\dest\destfile.txt",0,True)
' MsgBox "done"
End Sub

I tried for a while to find a purely internal solution and had to go with these in the end.

Cheers,

TSR

.



Relevant Pages

  • Re: unzipping file and overwritting old file...
    ... 'This function uses molezip to unzip a single file. ... Unfortunately I haven't been able to find anyone who has successfully scripted it so I had to use an external control. ... Sub ZipFile ...
    (microsoft.public.windows.server.scripting)
  • Re: incrementing numbers
    ... All the DIR command did was to generate a list of all the .zip files - ... script is great and I really do appreciate it. ... So the original code is... ... unzip the files I need out of the zip. ...
    (comp.lang.awk)
  • Re: Can I list contents of nested zipfile using Archive::Zip without extracting the outermost zip?
    ... Sorry I misunderstood your question. ... I am not familiar with the Archive::Zip module, but the following script ... C:\Home> unzip -l test1.zip ... Sinan Unur ...
    (comp.lang.perl.misc)
  • Re: incrementing numbers
    ... The command for this is wzunzip.exe -e -s ... script is great and I really do appreciate it. ... unzip the files I need out of the zip. ... Rename the files to include yesterdays date. ...
    (comp.lang.awk)
  • Re: Extracting zipfiles in their own directory.
    ... On 2005-11-10, Dave wrote: ... >> c) unzip any .zip files in that directory ... If it's something you do frequently, it belongs in a script. ... > No zipfiles found. ...
    (comp.unix.shell)