homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

Is it possible to use relative path names?

 8:20 am on Jul 3, 2005 (gmt 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 Jul 5, 2005 (gmt 0)

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 Jul 5, 2005 (gmt 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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved