Unzip Script
-
Thursday, June 07, 2012 5:08 PM
Hi, i want to extract all zip files from my ZIP folder to Destination drive.
i am using below script, but this is not supporting multiple files.
pathToZipFile="C:\myzip.zip" extractTo="C:\myfolder\" 'destination folder must exist! Set SA = CreateObject("Shell.Application") Set filesInzip=SA.NameSpace(pathToZipFile).items SA.NameSpace(extractTo).CopyHere(filesInzip)
Please help me out.
All Replies
-
Thursday, June 07, 2012 5:26 PMModerator
Hi,
99.999999% of the time, it is much simpler, easier, and more robust to just use a command-line zip utility such as the command-line version of 7-Zip.
Bill
-
Thursday, June 07, 2012 8:54 PM
Place a WScript.Sleep 600000 line at the end of the file and hit Ctl--C after you are sure all files have been deleted.
You can also scan the output folder until it has the same number of files as the zip.
Change this line:
SA.NameSpace(extractTo).CopyHere(filesInzip)
To this:
SA.NameSpace(extractTo).CopyHere(filesInzip,16)
¯\_(ツ)_/¯
- Edited by jrvMicrosoft Community Contributor Thursday, June 07, 2012 9:09 PM
-
Thursday, June 07, 2012 9:17 PM
Here is a better example that will wait for all files to be unzipped.
UnZip "e:\test2\myapp.zip", "e:\test2\arc" ' Function UnZip( archivepath, targetpath ) Set sh = CreateObject("shell.application") Set ns=sh.namespace("e:\test2\arc1") Set files = sh.namespace("e:\test2\myapp.zip").Items ns.CopyHere files, 4+16+512 End Function¯\_(ツ)_/¯
- Proposed As Answer by Richard MuellerMVP, Moderator Tuesday, June 12, 2012 12:44 AM
- Marked As Answer by Richard MuellerMVP, Moderator Thursday, June 14, 2012 12:32 AM
-
Thursday, June 14, 2012 12:32 AMModerator
As there has been no activity in this thread for a few days, we assume the issue is resolved. We will mark it as "answered" to assist others in similar situations. If you disagree, please reply with further information. You can unmark the answer if you wish. If a reply helped answer your question, please mark it as the answer.
Richard Mueller - MVP Directory Services

