Thread Verzeichnisse TARen in PERL (12 answers)
Opened by pacey at 2004-03-01 10:35

pacey
 2004-03-02 08:21
#80440 #80440
User since
2004-03-01
23 Artikel
BenutzerIn
[Homepage] [default_avatar]
guckt euch mal meine (absoluthässliche) lösung an, ich glaub ich werd wenn strat das sieht eine auf die nase kriegen, weil ich system aufrufe anstatt Module nehme :-).

@Heromaster: Probiere deinen Vorschlag nachher aus ;)

Code: (dl )
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
sub use_tar_dirs {
print "=> Using TAR Compression Method\n";
print "=> Compressing Directories\n";
my $tar = Archive::Tar->new;
my $dir = $_[0];
my $tarname = $_[1];
@fn = list_dir($dir);
chdir "./".$dir;
#foreach(@fn){print $_."\n";}
$tar->add_files( @fn );
$tar->write($tarname.'.tar');
}

sub list_dir {
my $os = get_os_version();
my $dir = $_[0];
my @fn;
if($os eq "win"){
chdir ".\\".$dir;
chomp(@fn = `dir /B`);
}
else {
chdir "./".$dir;
@fn = `ls -1`;
}
return(@fn);
}
sub s2a {
my $s = $_[0];
my @a = split(/,/, $s);
return(@a);
}


gruss pacey
Quote
If You don't know what it does, why do you put it in your code

Code: ()
1
2
3
print +(a=>b=>c=>d=>e=>f=>g=>h=>i=>j=>k=>l=>m=>n=>o=>p=>q=>r=>s=>t=>u=>v=>w=>x=>y=>z=>" ")

[9=>20=>18=>19=>-1=>0=>13=>14=>19=>7=>4=>17=>-1=>15=>4=>17=>11=>-1=>7=>0=>2=>10=>4=>17];

View full thread Verzeichnisse TARen in PERL