how to get perl to untar a tar.gz to a different directory

Discussion in 'Perl Misc' started by Jack, Jul 21, 2006.

  1. Jack

    Jack Guest

    Hello

    I am running gunzip.exe and tar.exe for DOS...with perl commands,
    Gunzip let's me unzip the tar to a different directory as follows:

    system("gunzip c:\\temp2\\$filelistarray[$u]");
    system("tar -xvf c:\\temp2\\$filelistarray[$u]");

    BUT how do I untar AND gunzip out to a different directory ?? If I
    cant, what can I do from the command line in DOS ?? WINZIP command
    line add on of course doesnt support this capability..I find after
    buying..
    I realize this is the PERL forum but I figured since I post here a lot
    the folks would know this..

    Thanks,
    Jack
    Jack, Jul 21, 2006
    #1
    1. Advertising

  2. Jack

    Guest

    Jack wrote:
    > Hello
    >
    > I am running gunzip.exe and tar.exe for DOS...with perl commands,
    > Gunzip let's me unzip the tar to a different directory as follows:
    >
    > system("gunzip c:\\temp2\\$filelistarray[$u]");
    > system("tar -xvf c:\\temp2\\$filelistarray[$u]");
    >
    > BUT how do I untar AND gunzip out to a different directory ?? If I
    > cant, what can I do from the command line in DOS ?? WINZIP command
    > line add on of course doesnt support this capability..I find after
    > buying..
    > I realize this is the PERL forum but I figured since I post here a lot
    > the folks would know this..
    >
    > Thanks,
    > Jack

    Probably the simplest solution is to "chdir" to the desired directory
    before
    issuing the gunzip and tar commands.
    By the way, you may want to look at the Perl modules that may be
    available.(Archive::Tar; Compress::Zlib). I have used the tar module,
    and I believe it
    has some limitations with large files (may also be slower).
    Ken
    , Jul 21, 2006
    #2
    1. Advertising

  3. "Jack" <> writes:

    > I am running gunzip.exe and tar.exe for DOS...with perl commands,
    > Gunzip let's me unzip the tar to a different directory as follows:
    >
    > system("gunzip c:\\temp2\\$filelistarray[$u]");
    > system("tar -xvf c:\\temp2\\$filelistarray[$u]");
    >
    > BUT how do I untar AND gunzip out to a different directory ??


    Does your tar support the -z option? If so, just run 'tar -xzvf blah.tgz'
    to unzip & untar in one step.

    > I realize this is the PERL forum but I figured since I post here a lot
    > the folks would know this..


    Please don't make a habit out of that. A lot of folks here probably *do*
    know this, and HTML, and SQL, and a lot of other stuff. That doesn't make
    that other stuff on-topic for this group though.

    sherm--

    --
    Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Sherm Pendley, Jul 21, 2006
    #3
    1. Advertising

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. Claudio Grondi
    Replies:
    4
    Views:
    544
    Claudio Grondi
    Aug 20, 2005
  2. sumi
    Replies:
    1
    Views:
    342
    Fredrik Lundh
    Nov 7, 2005
  3. Jay Parlar

    Re: can i tar and untar using python

    Jay Parlar, Nov 7, 2005, in forum: Python
    Replies:
    0
    Views:
    398
    Jay Parlar
    Nov 7, 2005
  4. Replies:
    2
    Views:
    417
    Michael Hoffman
    Apr 24, 2007
  5. Ray Van Dolson
    Replies:
    0
    Views:
    312
    Ray Van Dolson
    Sep 23, 2009
Loading...

Share This Page