Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

tar options

by s_gaurav1091 (Beadle)
on Nov 14, 2005 at 05:40 UTC ( [id://508217]=perlquestion: print w/replies, xml ) Need Help??

s_gaurav1091 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: tar options
by saintmike (Vicar) on Nov 14, 2005 at 07:02 UTC
    To give your question at least a tiny perl slant:
    use Sysadm::Install qw(untar_in); untar_in("tarball.tgz", "directory");
Re: tar options
by gam3 (Curate) on Nov 14, 2005 at 15:50 UTC
    I don't think that there is anyway to do this with tar. What you can do is rename the directory right after you extract the archive.

    The code below will work for tars that have a single directory in them.

    #!/usr/bin/perl my $name = "xxxx.tar"; my $oldname = "xxxx"; my $newname = "myxx"; mkdir "_extract"; system("tar -C _extract -xf $name"); rename "_extract/$oldname", "$newname"; rmdir "_extract";
    -- gam3
    A picture is worth a thousand words, but takes 200K.
Re: tar options
by spiritway (Vicar) on Nov 14, 2005 at 05:53 UTC

    Try 'man tar'.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://508217]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-19 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found