Hello Monks,

How do I modify the directory structure within Archive::Tar and mofiy its "path". For example I have a set of directories that reside in C:\users\temp\DIR1\DIR2\FILE.txt. I want to tar up \DIR1\DIR2\FILE.txt, and not C:\users\temp. How can I go about this? I am using the following code:

use Archive::Tar; $JOE = $ENV{"TEMP"}; my $tar = Archive::Tar->new; #I then define $city, $category and $page_number $tar->add_files("$JOE/$city/$category/$page_number", "$JOE/$city/$cate +gory/filedesc"); $tar->write('c:\files.tar');

When I then go and look in c:\files.tar, the entire temp path along with the directories I want are there. I have tried to rename them like so:

$tar->rename( "$JOE\$city\$category\$page_number", "/$city/$catego +ry/$page_number" ); $tar->rename( "$JOE/$city/$category/filedesc", "/filedesc" );

But that gives me all kinds of path errors. Can't I specify the "path" or the files within Archive::Tar?

Thank you.

In reply to Archive::Tar and the paths within by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.