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

J

Jack

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
 
K

kenslaterpa

Jack said:
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
 
S

Sherm Pendley

Jack said:
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--
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top