Solved

Extract all zip files in a specific folder

Posted on 2011-09-27
19
457 Views
Last Modified: 2012-05-12
Is there a way to extract zip files in folder a folder automatically with out having to hard code each zip file?  Each of the zip file has password also to it.
0
Comment
Question by:goretailpro
  • 7
  • 5
  • 5
  • +2
19 Comments
 
LVL 10

Expert Comment

by:ReneGe
ID: 36713321
What zip software are you using?
0
 
LVL 11

Expert Comment

by:paultomasi
ID: 36713833
Use 7zip. Perfect for the job !!

Get it from: http://www.7-zip.org/
0
 
LVL 33

Expert Comment

by:sarabande
ID: 36714853
you can use winzip at the commandline. so a batch solution is possible

@echo off
for /f "delims=" %%i in ('dir /b *.zip') do winzip -e "%%i" "%%~nI" -sPaSsWoRd

Open in new window

if each file has a different password you would need to call a second batch in the for loop (or a console program you provide) which is able to add the password to each file passed.

Sara

0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 36716507
Are the passwords all the same, or unique to each file?  If all the same then it's doable, if different then it seems like you'd have to do single file sensitive processing so you knew which password to use.

~bp
0
 

Author Comment

by:goretailpro
ID: 36716744
They are the same ...
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 36716803
Is the target location for the extracted files the same for all zips, if so then you should be able to just use a wildcard filter on the zip command line, like:

7z x *.zip -psecret -oc:\temp

~bp
0
 
LVL 33

Expert Comment

by:sarabande
ID: 36716857
the batch file i posted would create a folder of same name as the zip file.

if you don't like the password to be stored in a batchfile you could pass it as argument instead.

then the for statement would change to

for /f "delims=" %%i in ('dir /b *.zip') do winzip -e "%%i" "%%~nI" -s%1

Open in new window


Sara
0
 

Author Comment

by:goretailpro
ID: 36717203
Sara & Billprew,

Yes I would like the data extracted from all into one specfic folder.
0
 
LVL 33

Assisted Solution

by:sarabande
sarabande earned 200 total points
ID: 36717355
do you have winzip?

if yes, open a command window, navigate to the folder where the zip files are and type

for /f "delims=" %i in ('dir /b *.zip') do winzip -spassword -e "%i" c:\temp\xxx

the c:\temp\xxx would be the folder.

if that works you could create a batchfile like the one i posted.

Sara
0
[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

 
LVL 52

Expert Comment

by:Bill Prew
ID: 36717371
==> Yes I would like the data extracted from all into one specfic folder.

Okay, 7z with wildcards would work as I mentioned above then.

~bp
0
 

Author Comment

by:goretailpro
ID: 36717544
I own winzip...
0
 
LVL 33

Expert Comment

by:sarabande
ID: 36717651
i checked winzip on my notebook and found out that it is winzip32 and not only winzip.

try to start winzip32 from command line. type

winzip32 /?

and if that works also the for statement should work.

if you get an error you need to use the full path to winzp32.

assuming it is installed at c drive then do

c:
cd \
dir /s winzip*.exe

that should give you the path to winzip32.exe.

Sara
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 36717696
For winzip you actually want to get the command line addon (free to licensed owners) and use that from BAT files.

http://www.winzip.com/prodpagecl.htm

~bp
0
 
LVL 33

Expert Comment

by:sarabande
ID: 36717747
my winzip32.exe works from commandline. i didn't install an add-on for that.


Sara
0
 

Author Comment

by:goretailpro
ID: 36717765
I already know the full path to winzip command line:

"C:\Program Files\WinZip\wzunzip.exe"
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 36718499
Then it should be as simple as:

"C:\Program Files\WinZip\wzunzip.exe" c:\fromdir\*.zip c:\destdir

~bp
0
 

Author Comment

by:goretailpro
ID: 36718731
Billprew where should I add the password part since these zip files have passwords in them.
0
 
LVL 52

Accepted Solution

by:
Bill Prew earned 300 total points
ID: 36719470
Sorry, should have included that.

"C:\Program Files\WinZip\wzunzip.exe" -s12345678 c:\fromdir\*.zip c:\destdir

where 12345678 would be the password.

~bp
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 36719485
Also, fyi, if you do WZUNZIP at a command line with noting else it will open the help file where the various command line options are discussed.

~bp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now