Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding directories in Archive::Tar

Status
Not open for further replies.

BenRussell

Programmer
Mar 12, 2001
243
0
0
US
I am using Archive::Tar to make a backup of some files and directories on my server. This works fine:

Code:
$archive->add_files("/etc/SOMEFILE");

IF, SOMEFILE is actually a file and not a directory.

However, when I try to add a directory like so:

Code:
$archive->add_files("/etc/SOMEDIRECTORY");

It does not work. Any ideas on how to add a directory to the archive?

- Ben
 
Does anybody have any information on this?

- Ben
 
I don't see anything indicating that you can add a directory like that, but you can always build a file list using [tt]File::Find[/tt]

Code:
use File::Find;

my @files;

sub addfile { push @files, $File::Find::name; }

find(\&addfile, "/etc/SOMEDIRECTORY");

$archive->add_files(@files);

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top