Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies


Is it possible to use relative path names?

8:20 am on Jul 3, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 7, 2003
votes: 0

Is it possible to use the Archive::Tar module with relative path names, so that I can archive all files of the /home/domain1/public_html directory, and extract the archive file on another server: /home/domain2/public_html?
4:34 pm on July 5, 2005 (gmt 0)

Moderator from GB 

WebmasterWorld Administrator mack is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:June 15, 2001
votes: 4

There are a number of commercial options available for this, I also found this article that may be of use to you.


This is very acheivable of you are intending to backup the tar file to another server on your network.


6:52 pm on July 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
votes: 0

Yes, Archive::Tar does relative pathames. Here's a little command line script (call it at.pl) to demonstrate:
use Archive::Tar;
die "Usage: at.pl <dir> [<dir>...]\n" unless @ARGV;
my $tar = Archive::Tar->new;
for my $dir (@ARGV) {
$dir =~ s'/+$'';
$tar->add_files(glob "$dir/*");

Start it from the root of the directory you want to save, e.g.:
$ cd /home/domain1
$ at.pl public_html

For full details, take a look at perldoc Archive::Tar. If you're using this for anything but a small number of files, you should probably use the os tar cmd instead. Also, this script is very basic - it doesn't do much error checking, and doesn't handle nested directories correctly.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members