On 02/11/04 06:39, Thind, Aman wrote:
Thanks for the response David.

When I do 'Archive::Tar->create_archive("/tmp/test.tar",0,glob("*.pl"))' it
tars all the .pl files in the current working directory.

However, I need to tar a folder which has many folders inside it.

I tried 'Archive::Tar->create_archive("/tmp/test.tar",0,glob("*.*"))' and
'Archive::Tar->create_archive("/tmp/test.tar",0,glob("*"))'

But both gave only the files in the current folder and did not recurse
inside it.

How do I archive a folder with many folders inside ? (perhaps the key lies
in glob...i searched but couldn't find a flag to make it recurse)


something like the (untested) code below should work:


use Archive::Tar;
use File::Find;

use strict;
use warnings;

my @files;
find sub {
  return if -d;
  push @files, $File::Find::name;
}, 'Module-Build'

Archive::Tar->create_archive( 'test.tar', @files );

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to