use strict; use warnings; use autodie;
use Archive::Tar;
my @filelist = ();
opendir(my $dir, '/path/to/my/dir/');
while(readdir $dir) {
chomp;
if (!~ /(^\.\.|\.)$/){
push @filelist, $_;
}
}
my $pack = Archive::Tar->new;
$pack->create_archive('Bundle-FinalTest.tgz', COMPRESS_GZIP, @filelist
+);
closedir $dir;
UPDATE: A couple of changes, but Not properly working still... a lot of "not such file: filename" error messages, I don't know why
Alternatively, you can use the old cheap way, that is guaranteed to act as you expect:
`tar -zcvvf Bundle-FinalTest.tgz /path/to/Bundle/FinalTest/dir/`; |