avik1612 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: problem in unzipping the zip file
by atemon (Chaplain) on Oct 04, 2007 at 06:52 UTC
Re: problem in unzipping the zip file
by erroneousBollock (Curate) on Oct 04, 2007 at 06:14 UTC
    This should probably be in SoPW.

    Could you please read Writeup Formatting Tips and then update your post so that we can read your code easily?

    -David.

Re: problem of unzipping the zip file
by shmem (Chancellor) on Oct 04, 2007 at 09:28 UTC
    It is unzipping but it is skipping directories inside the zip file
    Of course it does skip them, since you coded that
    next if $member->isDirectory;

    and you remove the path component of the files in the archive

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

    so all files end up in the same directory.

    Did you forget what you wrote? Is that really your code?

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: problem in unzipping the zip file
by sago (Scribe) on Oct 04, 2007 at 06:32 UTC

    use Archive::Zip;
    opendir(PREV,"C:/Documents and Settings/Sam_Gov/Desktop/test_file/");
    while ($file = readdir(PREV)) {
    if ($file = test_file1.txt)
    {
    $addfile = "C:/Documents and Settings/Sam_Gov/Desktop/test_file/" . $file;
    $zipfile = "C:/Documents and Settings/Sam_Gov/Desktop/test_file/" . $file . ".zip";
    $zip = Archive::Zip->new();
    $zip->addFile( $addfile );
    $zip->writeToFileNamed( $zipfile );
    }
    }
    closedir(PREV);
    i tried the above code to zip the file, when i try to unzip, it worked fine for me.