Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
tarファイルの作成
[go: Go Back, main page]

tarファイルの作成


 Archive::Tarモジュールを使います。
use strict;
use warnings;

use Archive::Tar;

my $tar = Archive::Tar->new();
$Archive::Tar::WARN = 0; # 警告を出力しない

my @files = (
	"foo.txt",
	"bar.txt",
);
my $archive_file = 'out.tar';

foreach my $file (@files) {
	print "add ... $file\n";
	$tar->add_files($file) or die $tar->error();
}
print "create ... $archive_file\n";
$tar->write($archive_file) or die $tar->error();

関連項目

tarファイルの展開
tarファイルの一覧