Download a zip file and extract to a directory

Discussion in 'Perl Misc' started by david.karr, Apr 9, 2010.

  1. david.karr

    david.karr Guest

    I've written some scripts that manipulate Zip files using
    Archive::Zip. I'm now working on a script that uses "LWP::Simple" to
    download data from a URL. As part of this process I'm going to have
    to download a zip file from a URL and then extract that zip file to a
    particular directory.

    Can I use LWP::Simple to download a binary file directly into a
    variable?

    I've looked at the Archive::Zip methods, and it doesn't appear as if I
    can create the Zip object directly from the contents of a variable.
    Will I have to download the zip file directly to a temporary file
    (using "getstore($url, $file)"), I would imagine), and then create the
    Zip object from that?

    I see the "extractToFileHandle( $fh )" method on Archive::Zip. Is that
    file handle supposed to be a directory?
     
    david.karr, Apr 9, 2010
    #1
    1. Advertisements

  2. david.karr

    david.karr Guest

    On Apr 9, 3:34 pm, "david.karr" <> wrote:
    > I've written some scripts that manipulate Zip files using
    > Archive::Zip.  I'm now working on a script that uses "LWP::Simple" to
    > download data from a URL.  As part of this process I'm going to have
    > to download a zip file from a URL and then extract that zip file to a
    > particular directory.
    >
    > Can I use LWP::Simple to download a binary file directly into a
    > variable?
    >
    > I've looked at the Archive::Zip methods, and it doesn't appear as if I
    > can create the Zip object directly from the contents of a variable.
    > Will I have to download the zip file directly to a temporary file
    > (using "getstore($url, $file)"), I would imagine), and then create the
    > Zip object from that?
    >
    > I see the "extractToFileHandle( $fh )" method on Archive::Zip. Is that
    > file handle supposed to be a directory?


    Oh, never mind. Using "Archive::Extract" is much easier for
    extraction.
     
    david.karr, Apr 10, 2010
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    2,097
  2. HARI OM
    Replies:
    0
    Views:
    17,938
    HARI OM
    May 3, 2005
  3. sunil_varma
    Replies:
    1
    Views:
    1,632
  4. Dave Kuhlman

    ANN: zip-ls -- Zip file listing program

    Dave Kuhlman, Jul 19, 2003, in forum: Python
    Replies:
    0
    Views:
    537
    Dave Kuhlman
    Jul 19, 2003
  5. abcd
    Replies:
    7
    Views:
    801
    Edward Elliott
    May 1, 2006
  6. majj81
    Replies:
    0
    Views:
    503
    majj81
    May 31, 2006
  7. John
    Replies:
    7
    Views:
    445
    Moonlit
    Aug 19, 2006
  8. Twig
    Replies:
    1
    Views:
    263
    A. Sinan Unur
    Jan 27, 2006
Loading...