Solved

extract zip file

Posted on 2009-05-03
16
441 Views
Last Modified: 2012-05-06
How to extract zip file in perl....
0
Comment
Question by:tankergoblin
16 Comments
 
LVL 4

Expert Comment

by:ValleyENT
ID: 24292416
This should be what you need, this also includes how to zip files in perl. It may be a PIA, but it will work.
http://www.perlmonks.org/?node_id=262564
0
 
LVL 48

Expert Comment

by:Tintin
ID: 24292485
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24293121
there is no example in the link you given...

mind to write small program with example..
Do you mind to show a sub module of extract zip function... thank you
0
 
LVL 48

Expert Comment

by:Tintin
ID: 24293229
If you don't want to use the Archive::Zip module, you can always just do

system "unzip file.zip" and die "Can not unzip file.zip $!\n";
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24300951
mind to show me some code??

can you do a dummy program for me to understand how it works?
0
 
LVL 48

Expert Comment

by:Tintin
ID: 24301531
Do you want an example with Archive::Zip or was the last example sufficient?
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24302039
i know where to find those example. but any try those example? does it works?

Any one mind to show me simple program on how to extract the zip file .
0
 
LVL 48

Expert Comment

by:Tintin
ID: 24302130
system "unzip file.zip" and die "Can not unzip file.zip $!\n";

will unzip a file assuming you have unzip on your system.
0
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.

 
LVL 7

Author Comment

by:tankergoblin
ID: 24302183
???
The one you show me in the link is zip file not extract file
where should i put unzip file.zip can you show me the full program?
0
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 24302315
The full program is
#!/usr/bin/perl

system "unzip /path/to/file.zip" and die "Can not unzip file.zip $!\n";

Open in new window

0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24302352
is this the path i unzip my file to?unzip /path/to/file.zip
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24302365
how to create folder or specify path i want to store my file to.
say i have 100 files..
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24302373
why it extract one file only from zip, i have more than one file in zip
0
 
LVL 39

Expert Comment

by:Adam314
ID: 24305930
The code will unzip all of the files in the named zip file to the current directory.  If you want, you can change your directory first using:
    chdir('/path/to/save/files') or die "Could not chdir: $!\n";
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24310858
no it does not store in current directory

say i store my zip in c:/test
but text file will unzip to c:/
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24310905
ok thanks i got it
but i can only extract one file
say in my zip file i have 10 files but i can only extract 1 file
how to extract all the file from zip
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

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

919 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

24 Experts available now in Live!

Get 1:1 Help Now