Leser: 1
|< 1 2 >| | 11 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use strict;
use warnings;
use File::Find;
use File::Basename;
use IO::File;
use Archive::Tar;
testArchive();
sub testArchive
{
use Archive::Tar;
our $tar = Archive::Tar->new();
our @names;
my $doc;
find (\&wanted, ".");
sub wanted
{
if (-f $File::Find::name)
{
print "Pushing file '" . $File::Find::name . "'.\n";
push @names, $File::Find::name;
}
}
foreach my $name (@names)
{
print "Name is '" . $name . "'.\n";
if (open(FILE, "<$name"))
{
binmode FILE;
while (<FILE>)
{
$doc .= $_;
}
close (FILE);
}
else
{
print "Error: Failed to open '" . $name . "'!\n";
}
my @path = fileparse ($name);
$name = join ('', $path[0], $path[2]);
$tar->add_data($name, $doc);
$doc = '';
}
$tar->write("test.tar.gz", 1);
}
1
2
3
4
5
6
7
8
9
#! /usr/bin/perl
use strict;
use warnings;
use Archive::Tar;
my $archive = Archive::Tar->new();
$archive->add_files('../SOM/both/file1.txt','../SOM/both/file2.txt');
$archive->write('test.tar.gz',1);
1
2
3
4
5
6
7
8
9
#!/usr/bin/perl
use strict;
use warnings;
use Archive::Tar;
my $archive = Archive::Tar->new();
$archive->add_files( qw( /absoluter/pfad/erste.test /absoluter/pfad/zwote.test );
$archive->write('test.tar.gz',1);
|< 1 2 >| | 11 Einträge, 2 Seiten |