codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  problem in unzipping the zip files  avik1612 at 05:25 on Thursday, October 04, 2007
 

hi,

i have created a code to unzip the zip files to a particular destination

It is unzipping but it is skipping directories inside the zip file

what should i do. I have pasted my code

# Script to unzip the zip files to a particular destination creating the folder with the name of zip file

use Archive::Zip;
use Archive::Tar;
use File::Copy;
use File::Find;
use File::Basename;

my @ext;

find(\&search, "D:/aaa");

sub search
{
if ((/\.zip$/) )
{
push @ext, $File::Find::name;
#print "@ext\n";
}
}


my @name1;
foreach my $fname(@ext)
{
my ($name, $path, $suffix) = fileparse($fname, '\.[^\.]*');

my $n = "D:/a/";
my $name1 = join("/index.html",$n,$name);

# Making folder with the name of the zip file found
mkdir $name1,0755;

print "\n\n Made Folder ";

print STDOUT $name, "\n";

my $zipname = $fname;

my $destinationDirectory = $name1;

my ($archive, $want, $dir) = shift;
my $zip = Archive::Zip->new($zipname);
foreach my $member ($zip->members)
{

next if $member->isDirectory;

(my $extractName = $member->fileName) =~ s{.*/}{};
$member->extractToFileNamed("$destinationDirectory/$extractName");



}
print "\n Extraction Completed.............";
}



Thanks in Advance
Avi








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: How to open a MS Word document from Javascript
•  controlling an app in foreground from one running in background
•  Re: Plz its urgent:validation code
•  Carrying Value of Checkbox
•  problem in unzipping the zip files
•  Re: substitution using vars containing $1
•  frameElement question
•  What is the problem with this macro
•  Rewrite this program with good style


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007