niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
· nixdoc.net · man pages · Linux HOWTOs · FreeBSD Tips · Forums
navigation Forum index » Programming » Perl
how to get perl to untar a tar.gz to a different directory
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Jack
*nix forums Guru Wannabe


Joined: 27 Feb 2005
Posts: 161

PostPosted: Fri Jul 21, 2006 12:40 am    Post subject: how to get perl to untar a tar.gz to a different directory Reply with 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
Back to top
kenslaterpa@hotmail.com
*nix forums beginner


Joined: 21 Jun 2006
Posts: 4

PostPosted: Fri Jul 21, 2006 1:01 am    Post subject: Re: how to get perl to untar a tar.gz to a different directory Reply with quote

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

PostPosted: Fri Jul 21, 2006 1:32 am    Post subject: Re: how to get perl to untar a tar.gz to a different directory Reply with quote

"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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Fri Sep 03, 2010 1:55 pm | All times are GMT
navigation Forum index » Programming » Perl
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts postfix - mail directory bandito Postfix 0 Tue Dec 09, 2008 11:13 pm
No new posts Need Help with Program in Perl on a Netware Server fhadzocos@gmail.com Perl 3 Fri Jul 21, 2006 1:57 pm
No new posts problems using oddmuse with mod_perl2 inside apache2.2 pe... Fergus McMenemie Perl 0 Fri Jul 21, 2006 9:48 am
No new posts Problem with Win32-SerialPort over bluetooth @ windows + ... ctloh Perl 0 Fri Jul 21, 2006 8:08 am
No new posts Posting Guidelines for comp.lang.perl.misc (: 1.... Tad McClellan Perl 0 Fri Jul 21, 2006 7:22 am

Copyright © 2004-2005 DeniX Solutions SRL
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum |  email marketing service
 
Sponsors: Find jobs | Debt Help | Canon 500d | Breast Enlargement | Breast Enlargement
Privacy Policy
[ Time: 0.0966s ][ Queries: 17 (0.0669s) ][ GZIP on - Debug on ]