Schrift
Wiki:Tipp zum Debugging: use Data::Dumper; local $Data::Dumper::Useqq = 1; print Dumper \@var;
[thread]12112[/thread]

Problem beim entzippen nach zippen mit archive::zip

Leser: 1


<< >> 1 Eintrag, 1 Seite
electracks
 2008-07-01 18:41
#111725 #111725
User since
2008-03-05
6 Artikel
BenutzerIn
[default_avatar]
Ich bin mit meinem Latein am Ende! Ich versuche nun seit einigen Wochen den Fehler in meinem Skript zu finden und krieg es einfach nicht hin.

Ich habe folgendes Skript, es packt bestimmte Ordner in zwei Zip Dateien:

Code (perl): (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
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
use strict;
use File::Copy::Reliable;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );

# Sourceverzeichnis Conditions
my $sourcecond = "C:/Testumgebung/testcond/";
# Sourceverzeichnis Orders
my $sourceorder = "C:/Testumgebung/testorder/";

my @dateien;
my $datei;
my $verz;
my @ziporder;
my @zipcond;
my @time = localtime(time);

# Auslesen des Sourceverzeichnisses für Conditions
opendir(VERZ, $sourcecond);
    while(defined($datei = readdir(VERZ))) {
        chomp($datei);
        if (-d $sourcecond.$datei and $datei ne '.' and $datei ne '..' )
        {
        mkdir $sourcecond."old/";
        move_reliable($sourcecond.$datei, $sourcecond."old/".$datei)
        }
        elsif( $datei ne '.' and $datei ne '..' ) {
            push(@dateien, $datei);
        }
    }
    closedir(VERZ);

# Bestimmen von Jahr, Monat und Tag und Sortierfunktion
foreach my $file (@dateien){
my @last = localtime((stat($sourcecond.$file))[9]);
my $mon =  sprintf("%02d",$last[4]+1);
my $year = $last[5]+1900;
my $destinationcond = $sourcecond.$year."-".$mon."/";

if (-d $sourcecond.$file){};
if ($time[5] gt $last[5]){
mkdir $destinationcond;
move_reliable( $sourcecond.$file, $destinationcond.$file );
};

if ($time[5] eq $last[5] & $time[4] gt $last[4]){
mkdir $destinationcond;
move_reliable( $sourcecond.$file, $destinationcond.$file );
};

};

# Auslesen des Sourceverzeichnisses für Conditions
opendir(VERZ, $sourcecond);
    while(defined($datei = readdir(VERZ))) {
        chomp($datei);
        if (-d $sourcecond.$datei and $datei ne '.' and $datei ne '..' and $datei ne 'old')
        {
        push(@zipcond, $sourcecond.$datei."/");
        }
    }
    closedir(VERZ);
print @zipcond;
# Packen der conditions Daten
my $cond = Archive::Zip::->new();

foreach my $untercond (@zipcond){
$cond->addTree($untercond,$untercond);
};

unless ( $cond->writeToFileNamed($sourcecond.'backupconditions.zip') == AZ_OK ) {
       die 'write error';
   };

# Auslesen des Sourceverzeichnisses für Orders
opendir(VERZ, $sourceorder);
    while(defined($datei = readdir(VERZ))) {
        chomp($datei);
          if (-d $sourceorder.$datei and $datei ne '.' and $datei ne '..'){move_reliable($sourceorder."old/".$datei)}
        elsif( $datei ne '.' and $datei ne '..' ) {
            push(@dateien, $datei);
        }
    }
    closedir(VERZ);

# Bestimmen von Jahr, Monat und Tag und Sortierfunktion
foreach my $file (@dateien){
my @last = localtime((stat($sourceorder.$file))[9]);
my $mon =  sprintf("%02d",$last[4]+1);
my $year = $last[5]+1900;
my $destinationorder = $sourceorder.$year."-".$mon."/";
if ($time[5] gt $last[5]){
mkdir $destinationorder;
move_reliable( $sourceorder.$file, $destinationorder.$file );
};
if ($time[5] eq $last[5] & $time[4] gt $last[4]){
mkdir $destinationorder;
move_reliable( $sourceorder.$file, $destinationorder.$file );
};
};

# Auslesen der Unterverzeichnisse für Orders

    opendir(VERZ, $sourceorder);
    while(defined($verz = readdir(VERZ))) {
        chomp($verz);
          if (-d $sourceorder.$verz and $verz ne '.' and $verz ne '..' and $verz ne 'old')
          {
            push(@ziporder, $sourceorder.$verz."/");
        }
    }
    closedir(VERZ);
print @ziporder;
# Packen der Order Daten
my $order = Archive::Zip::->new();

foreach my $unterorder (@ziporder){
$order->addTree($unterorder,$unterorder);
};

unless ( $order->writeToFileNamed($sourceorder.'backuporders.zip') == AZ_OK ) {
       die 'write error';
   }


Soweit so gut!

Wenn ich die Zip Dateien nun auf einem anderen Rechner per unzip entpacken will kommt folgender Fehler:

unzip -Coqq D:\Data\users\Batch\PERL\infiles_archivieren\COND\backupconditions.zip
checkdir error: cannot create
unable to process
/Data/users/Batch/PERL/infiles_archivieren/COND/2007-07/.
checkdir error: cannot create
unable to process /Data/users/Batch/PERL/infiles_archivieren/COND/2007-07/IU.II.SPC.N.20080428.153000.IN.
checkdir error: cannot create
unable to process /Data/users/Batch/PERL/infiles_archivieren/COND/2007-09/.
checkdir error: cannot create
unable to process /Data/users/Batch/PERL/infiles_archivieren/COND/2007-09/CH.MZ.EXEMPT.CH_MZ_Ausnahmetabelle.in.


und so weiter.

Wenn ich ohne die Optionen -Coqq entzippe kommt ein anderer Fehler:

caution: filename not matched: /Data/users/Batch/PERL/infiles_archivieren/COND/2008-5/

Der Fehler muss beim Einpacken passieren, weil wenn ich eine manuell gezippte Datei per Skript entpacke bekomme ich keine Fehler.
<< >> 1 Eintrag, 1 Seite



View all threads created 2008-07-01 18:41.