print "working in $pc_dir\n";
sub extract_num($) {
- my $file = shift || die;
- my $nr = $1 if ($file =~ m/XferLOG\.(\d+)/);
- return $nr || die;
+ my $file = shift || die "no file?";
+ my $nr;
+ if ($file =~ m/XferLOG\.(\d+)/) {
+ $nr = $1;
+ } else {
+ die "can't extract number from $file";
+ }
+ return $nr;
}
my @logs = sort {
extract_num($a) <=> extract_num($b)
-} glob("$pc_dir/XferLOG*");
+} glob("$pc_dir/XferLOG.[0-9]*");
print "found ", $#logs + 1, " XferLOG files for $host\n";
print "WARNING: backups file $backups_file doesn't exist, creating new one\n";
}
+my @new_backups;
+
foreach my $xfer_log (@logs) {
my $num = extract_num($xfer_log);
my $xfer_fh = BackupPC::FileZIO->open($xfer_log, 0, $Conf{CompressLevel});
while ( my $line = $xfer_fh->readLine() ) {
chomp($line);
- if ($line =~ m#^\s+(create|pool|delete)\s+(.)\s\d\d\d\s+\d+/\d+\s+(\d+)\s(.+)$#) {
+ if ($line =~ m#^\s+(create|pool|delete|same|link)\s+(.)\s\d\d\d\s+\d+/\d+\s+(\d+)\s(.+)$#) {
my ($type,$is_dir,$size,$path) = ($1,$2,$3);
#print "$type [$is_dir] $size $path\n";
next if ($is_dir eq 'd');
- if ($type eq 'pool') {
+ if ($type eq 'pool' || $type eq 'same') {
$sizeExist += $size;
$nFilesExist++;
} elsif ($type ne 'delete') {
mangle => 1, # name mangling always on for v1.04+
};
- print Dumper($this_backup);
+ push @new_backups, $this_backup;
+ $bpc->BackupInfoWrite($host, @new_backups);
}