heezy has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Changing path length using Archive::Tar
by steves (Curate) on Feb 09, 2003 at 23:40 UTC | |
by waswas-fng (Curate) on Feb 10, 2003 at 05:07 UTC |