| Author |
Message |
Jack *nix forums Guru Wannabe
Joined: 27 Feb 2005
Posts: 161
|
Posted: Fri Jul 21, 2006 12:40 am Post subject:
how to get perl to untar a tar.gz to a different directory
|
|
|
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 |
|
| Back to top |
|
 |
kenslaterpa@hotmail.com *nix forums beginner
Joined: 21 Jun 2006
Posts: 4
|
Posted: Fri Jul 21, 2006 1:01 am Post subject:
Re: how to get perl to untar a tar.gz to a different directory
|
|
|
Jack wrote:
| Quote: | 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 |
|
| Back to top |
|
 |
Sherm Pendley *nix forums Guru
Joined: 03 Mar 2005
Posts: 527
|
Posted: Fri Jul 21, 2006 1:32 am Post subject:
Re: how to get perl to untar a tar.gz to a different directory
|
|
|
"Jack" <jack_posemsky@yahoo.com> writes:
| Quote: | 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.
| Quote: | 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 |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|