Hi

I have been using Archive::Tar for a while and I love it, it makes creating tar archives really simple. Except for one thing...

I am adding files to it with a path something like..

/apps/webroot/service/servicelist/ss/filename.blah

However when stored in the tar file I only want the path info stored like...

/servicelist/ss/filename.blah

You see at the moment it's storing the path from the root into the archive that Archive::Tar produces. I don't want this, just the path structure after the /service directory.

When I hand the files to other users it has the /apps/webroot/service section at the start that I do not need/want!

My script is being run from a completly different directory on the server /apps/servicelist/change-history and that is also where I would like the new tar files to appear

Here is the code I am using if anyone is interested..

my $tar = Archive::Tar->new(); foreach $updatedFile (@updatedFiles){ print "Adding to tar ($updatedFile)\n"; $tar->add_files("$updatedFile"); } foreach $newFile (@newFiles){ print "Adding to tar ($newFile)\n"; $tar->add_files("$newFile"); } $tar->write("$tarFile");

Can anyone suggested a way of overcoming this?

Thanks

M


In reply to Changing path length using Archive::Tar by heezy

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.