rename getUnits to getShares
[BackupPC.git] / lib / BackupPC / View.pm
1 #============================================================= -*-perl-*-
2 #
3 # BackupPC::View package
4 #
5 # DESCRIPTION
6 #
7 #   This library defines a BackupPC::View class for merging of
8 #   incremental backups and file attributes.  This provides the
9 #   caller with a single view of a merged backup, without worrying
10 #   about which backup contributes which files.
11 #
12 # AUTHOR
13 #   Craig Barratt  <cbarratt@users.sourceforge.net>
14 #
15 # COPYRIGHT
16 #   Copyright (C) 2002-2009  Craig Barratt
17 #
18 #   This program is free software; you can redistribute it and/or modify
19 #   it under the terms of the GNU General Public License as published by
20 #   the Free Software Foundation; either version 2 of the License, or
21 #   (at your option) any later version.
22 #
23 #   This program is distributed in the hope that it will be useful,
24 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
25 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 #   GNU General Public License for more details.
27 #
28 #   You should have received a copy of the GNU General Public License
29 #   along with this program; if not, write to the Free Software
30 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31 #
32 #========================================================================
33 #
34 # Version 3.2.0, released 31 Jul 2010.
35 #
36 # See http://backuppc.sourceforge.net.
37 #
38 #========================================================================
39
40 package BackupPC::View;
41
42 use strict;
43
44 use File::Path;
45 use BackupPC::Lib;
46 use BackupPC::Attrib qw(:all);
47 use BackupPC::FileZIO;
48 use Data::Dumper;
49 use Encode qw/from_to/;
50
51 use Data::Dump qw(dump);
52
53 sub new
54 {
55     my($class, $bpc, $host, $backups, $options) = @_;
56     my $m = bless {
57         bpc       => $bpc,      # BackupPC::Lib object
58         host      => $host,     # host name
59         backups   => $backups,  # all backups for this host
60         num       => -1,        # backup number
61         idx       => -1,        # index into backups for backup
62                                 #   we are viewing
63         dirPath   => undef,     # path to current directory
64         dirAttr   => undef,     # attributes of current directory
65         dirOpts   => $options,  # $options is a hash of file attributes we need:
66                                 # type, inode, or nlink.  If set, these parameters
67                                 # are added to the returned hash.
68                                 # See BackupPC::Lib::dirRead().
69     }, $class;
70     $m->{topDir} = $m->{bpc}->TopDir();
71     return $m;
72 }
73
74 sub dirCache
75 {
76     my($m, $backupNum, $share, $dir) = @_;
77     my($i, $level);
78
79     #print STDERR "dirCache($backupNum, $share, $dir)\n";
80     $dir = "/$dir" if ( $dir !~ m{^/} );
81     $dir =~ s{/+$}{};
82     return if ( $m->{num} == $backupNum
83                 && $m->{share} eq $share
84                 && defined($m->{dir})
85                 && $m->{dir} eq $dir );
86     $m->backupNumCache($backupNum) if ( $m->{num} != $backupNum );
87     return if ( $m->{idx} < 0 );
88
89     $m->{files} = {};
90     $level = $m->{backups}[$m->{idx}]{level} + 1;
91
92     #
93     # Remember the requested share and dir
94     #
95     $m->{share} = $share;
96     $m->{dir} = $dir;
97
98     my $previous_increment_entry;
99     my $increment_backupNum = $backupNum; # used in loop
100     my @visit_backup_ids;
101     my $i;
102     for ( $i = $m->{idx} ; $i >= 0 ; $i-- ) {
103
104         # we need two incremental backups to detect changes
105         next if $m->{backups}[$i]{level} >= $level && $#visit_backup_ids > 0;
106
107         push @visit_backup_ids, $i;
108
109         # for first full backup we need another full to detect changes
110         last if $m->{backups}[$i]{level} == 0 && $#visit_backup_ids > 0;
111     }
112     #warn "# visit_backup_ids = ",dump @visit_backup_ids;
113
114     #
115     # merge backups, starting at the requested one, and working
116     # backwards until we get to level 0.
117     #
118     $m->{mergeNums} = [];
119 #    for ( $i = $m->{idx} ; $level > 0 && $i >= 0 ; $i-- ) {
120     for my $i ( @visit_backup_ids ) {
121         #print(STDERR "Do $i ($m->{backups}[$i]{noFill},$m->{backups}[$i]{level})\n");
122         #
123         # skip backups with the same or higher level
124         #
125         #next if ( $m->{backups}[$i]{level} >= $level ); # ASA - visit_backup_ids
126
127         $level = $m->{backups}[$i]{level};
128         $backupNum = $m->{backups}[$i]{num};
129         push(@{$m->{mergeNums}}, $backupNum);
130         my $mangle   = $m->{backups}[$i]{mangle};
131         my $compress = $m->{backups}[$i]{compress};
132         my $path     = "$m->{topDir}/pc/$m->{host}/$backupNum/";
133         my $legacyCharset = $m->{backups}[$i]{version} < 3.0;
134         my $sharePathM;
135         if ( $mangle ) {
136             $sharePathM = $m->{bpc}->fileNameEltMangle($share)
137                         . $m->{bpc}->fileNameMangle($dir);
138         } else {
139             $sharePathM = $share . $dir;
140         }
141         $path .= $sharePathM;
142         #print(STDERR "Opening $path (share=$share, mangle=$mangle)\n");
143
144         my $dirOpts    = { %{$m->{dirOpts} || {} } };
145         $dirOpts->{inode} = 1 if $m->{dirOpts}->{only_increment}; # ASA - detect unchanged
146 #warn "# dirOpts = ",dump $dirOpts;
147         my $attribOpts = { compress => $compress };
148         if ( $legacyCharset ) {
149             $dirOpts->{charsetLegacy}
150                     = $attribOpts->{charsetLegacy}
151                     = $m->{bpc}->{Conf}{ClientCharsetLegacy} || "iso-8859-1";
152         }
153
154         my $dirInfo = $m->{bpc}->dirRead($path, $dirOpts);
155         if ( !defined($dirInfo) ) {
156             if ( $i == $m->{idx} ) {
157                 #
158                 # Oops, directory doesn't exist.
159                 #
160                 $m->{files} = undef;
161                 return;
162             }
163             next;
164         }
165         my $attr;
166         if ( $mangle ) {
167             $attr = BackupPC::Attrib->new($attribOpts);
168             if ( !$attr->read($path) ) {
169                 $m->{error} = "Can't read attribute file in $path: " . $attr->errStr();
170                 $attr = undef;
171             }
172         }
173         foreach my $entry ( @$dirInfo ) {
174             my $file = $1 if ( $entry->{name} =~ /(.*)/s );
175             my $fileUM = $file;
176             $fileUM = $m->{bpc}->fileNameUnmangle($fileUM) if ( $mangle );
177             #print(STDERR "Doing $fileUM\n");
178             #
179             # skip special files
180             #
181             next if ( 0 # defined($m->{files}{$fileUM}) # ASA - need fallthrough
182                     || $file eq ".."
183                     || $file eq "."
184                     || $file eq "backupInfo"
185                     || $mangle && $file eq "attrib" );
186
187
188                 # ASA - we only skip files when invoked with share name
189                 if ( $m->{dirOpts}->{only_increment} && $share ) {
190                         if ( defined $previous_increment_entry->{$fileUM}
191                         && $previous_increment_entry->{$fileUM}->{inode} == $entry->{inode} ) {
192                                 #warn "# -- $backupNum $fileUM\n";
193                                 $previous_increment_entry->{$fileUM}->{_hide}++;
194                                 next;
195                         } elsif ( $backupNum < $increment_backupNum ) {
196                                 #warn "# << $backupNum $fileUM\n";
197                                 $previous_increment_entry->{$fileUM}->{_hide}++;
198                                 next;
199                         } else {
200                                 #warn "# ++ $backupNum $fileUM ",dump $entry;
201                                 $previous_increment_entry->{$fileUM} = $entry;
202                         }
203                 } else {
204                         next if defined($m->{files}{$fileUM});
205                 }
206
207             if ( defined($attr) && defined(my $a = $attr->get($fileUM)) ) {
208                 $m->{files}{$fileUM} = $a;
209                 #
210                 # skip directories in earlier backups (each backup always
211                 # has the complete directory tree).
212                 #
213                 next if ( $i < $m->{idx} && $a->{type} == BPC_FTYPE_DIR );
214                 $attr->set($fileUM, undef);
215             } else {
216                 #
217                 # Very expensive in the non-attribute case when compresseion
218                 # is on.  We have to stat the file and read compressed files
219                 # to determine their size.
220                 #
221                 my $realPath = "$path/$file";
222
223                 from_to($realPath, "utf8", $attribOpts->{charsetLegacy})
224                                 if ( $attribOpts->{charsetLegacy} ne "" );
225
226                 my @s = stat($realPath);
227                 next if ( $i < $m->{idx} && -d _ );
228                 $m->{files}{$fileUM} = {
229                     type  => -d _ ? BPC_FTYPE_DIR : BPC_FTYPE_FILE,
230                     mode  => $s[2],
231                     uid   => $s[4],
232                     gid   => $s[5],
233                     size  => -f _ ? $s[7] : 0,
234                     mtime => $s[9],
235                 };
236                 if ( $compress && -f _ ) {
237                     #
238                     # Compute the correct size by reading the whole file
239                     #
240                     my $f = BackupPC::FileZIO->open($realPath,
241                                                     0, $compress);
242                     if ( !defined($f) ) {
243                         $m->{error} = "Can't open $realPath";
244                     } else {
245                         my($data, $size);
246                         while ( $f->read(\$data, 65636 * 8) > 0 ) {
247                             $size += length($data);
248                         }
249                         $f->close;
250                         $m->{files}{$fileUM}{size} = $size;
251                     }
252                 }
253             }
254             ($m->{files}{$fileUM}{relPath}    = "$dir/$fileUM") =~ s{//+}{/}g;
255             ($m->{files}{$fileUM}{sharePathM} = "$sharePathM/$file")
256                                                                =~ s{//+}{/}g;
257             ($m->{files}{$fileUM}{fullPath}   = "$path/$file") =~ s{//+}{/}g;
258             from_to($m->{files}{$fileUM}{fullPath}, "utf8", $attribOpts->{charsetLegacy})
259                                 if ( $attribOpts->{charsetLegacy} ne "" );
260             $m->{files}{$fileUM}{backupNum}   = $backupNum;
261             $m->{files}{$fileUM}{compress}    = $compress;
262             $m->{files}{$fileUM}{nlink}       = $entry->{nlink}
263                                                     if ( $m->{dirOpts}{nlink} );
264             $m->{files}{$fileUM}{inode}       = $entry->{inode}
265                                                     if ( $m->{dirOpts}{inode} );
266         }
267
268         #
269         # Also include deleted files
270         #
271         if ( defined($attr) ) {
272             my $a = $attr->get;
273             foreach my $fileUM ( keys(%$a) ) {
274                 next if ( $a->{$fileUM}{type} != BPC_FTYPE_DELETED );
275                 my $file = $fileUM;
276                 $file = $m->{bpc}->fileNameMangle($fileUM) if ( $mangle );
277                 $m->{files}{$fileUM}             = $a->{$fileUM};
278                 $m->{files}{$fileUM}{relPath}    = "$dir/$fileUM";
279                 $m->{files}{$fileUM}{sharePathM} = "$sharePathM/$file";
280                 $m->{files}{$fileUM}{fullPath}   = "$path/$file";
281                 from_to($m->{files}{$fileUM}{fullPath}, "utf8", $attribOpts->{charsetLegacy})
282                                     if ( $attribOpts->{charsetLegacy} ne "" );
283                 $m->{files}{$fileUM}{backupNum}  = $backupNum;
284                 $m->{files}{$fileUM}{compress}   = $compress;
285                 $m->{files}{$fileUM}{nlink}      = 0;
286                 $m->{files}{$fileUM}{inode}      = 0;
287             }
288         }
289     }
290
291         # ASA create increment
292         if ( $m->{dirOpts}->{only_increment} ) {
293                 #warn "# previous_increment_entry = ",dump $previous_increment_entry;
294                 foreach my $file ( grep { exists $previous_increment_entry->{$_}->{_hide} } keys %$previous_increment_entry ) {
295                         delete $m->{files}{$file};
296                         #warn "OLD $file\n";
297                 }
298         }
299
300     #
301     # Prune deleted files
302     #
303     foreach my $file ( keys(%{$m->{files}}) ) {
304         next if ( $m->{files}{$file}{type} != BPC_FTYPE_DELETED );
305         delete($m->{files}{$file});
306     }
307     #print STDERR "Returning:\n", Dumper($m->{files});
308 }
309
310 #
311 # Return list of shares for this backup
312 #
313 sub shareList
314 {
315     my($m, $backupNum) = @_;
316     my @shareList;
317
318     $m->backupNumCache($backupNum) if ( $m->{num} != $backupNum );
319     return if ( $m->{idx} < 0 );
320
321     my $mangle = $m->{backups}[$m->{idx}]{mangle};
322     my $path = "$m->{topDir}/pc/$m->{host}/$backupNum/";
323     return if ( !opendir(DIR, $path) );
324     my @dir = readdir(DIR);
325     closedir(DIR);
326     foreach my $file ( @dir ) {
327         $file = $1 if ( $file =~ /(.*)/s );
328         next if ( $file eq "attrib" && $mangle
329                || $file eq "."
330                || $file eq ".."
331                || $file eq "backupInfo"
332             );
333         my $fileUM = $file;
334         $fileUM = $m->{bpc}->fileNameUnmangle($fileUM) if ( $mangle );
335         push(@shareList, $fileUM);
336     }
337     $m->{dir} = undef;
338     return @shareList;
339 }
340
341 sub backupNumCache
342 {
343     my($m, $backupNum) = @_;
344
345     if ( $m->{num} != $backupNum ) {
346         my $i;
347         for ( $i = 0 ; $i < @{$m->{backups}} ; $i++ ) {
348             last if ( $m->{backups}[$i]{num} == $backupNum );
349         }
350         if ( $i >= @{$m->{backups}} ) {
351             $m->{idx} = -1;
352             return;
353         }
354         $m->{num} = $backupNum;
355         $m->{idx} = $i;
356     }
357 }
358
359 #
360 # Return the attributes of a specific file
361 #
362 sub fileAttrib
363 {
364     my($m, $backupNum, $share, $path) = @_;
365
366     #print(STDERR "fileAttrib($backupNum, $share, $path)\n");
367     if ( $path =~ s{(.*)/+(.+)}{$1}s ) {
368         my $file = $2;
369         $m->dirCache($backupNum, $share, $path);
370         return $m->{files}{$file};
371     } else {
372         #print STDERR "Got empty $path\n";
373         $m->dirCache($backupNum, "", "");
374         my $attr = $m->{files}{$share};
375         return if ( !defined($attr) );
376         $attr->{relPath} = "/";
377         return $attr;
378     }
379 }
380
381 #
382 # Return the contents of a directory
383 #
384 sub dirAttrib
385 {
386     my($m, $backupNum, $share, $dir) = @_;
387
388     $m->dirCache($backupNum, $share, $dir);
389     return $m->{files};
390 }
391
392 #
393 # Return a listref of backup numbers that are merged to create this view
394 #
395 sub mergeNums
396 {
397     my($m) = @_;
398
399     return $m->{mergeNums};
400 }
401
402 #
403 # Return a list of backup indexes for which the directory exists
404 #
405 sub backupList
406 {
407     my($m, $share, $dir) = @_;
408     my($i, @backupList);
409
410     $dir = "/$dir" if ( $dir !~ m{^/} );
411     $dir =~ s{/+$}{};
412
413     for ( $i = 0 ; $i < @{$m->{backups}} ; $i++ ) {
414         my $backupNum = $m->{backups}[$i]{num};
415         my $mangle = $m->{backups}[$i]{mangle};
416         my $path   = "$m->{topDir}/pc/$m->{host}/$backupNum/";
417         my $sharePathM;
418         if ( $mangle ) {
419             $sharePathM = $m->{bpc}->fileNameEltMangle($share)
420                         . $m->{bpc}->fileNameMangle($dir);
421         } else {
422             $sharePathM = $share . $dir;
423         }
424         $path .= $sharePathM;
425         next if ( !-d $path );
426         push(@backupList, $i);
427     }
428     return @backupList;
429 }
430
431 #
432 # Return the history of all backups for a particular directory
433 #
434 sub dirHistory
435 {
436     my($m, $share, $dir) = @_;
437     my($i, $level);
438     my $files = {};
439
440     $dir = "/$dir" if ( $dir !~ m{^/} );
441     $dir =~ s{/+$}{};
442
443     #
444     # merge backups, starting at the first one, and working
445     # forward.
446     #
447     for ( $i = 0 ; $i < @{$m->{backups}} ; $i++ ) {
448         $level        = $m->{backups}[$i]{level};
449         my $backupNum = $m->{backups}[$i]{num};
450         my $mangle    = $m->{backups}[$i]{mangle};
451         my $compress  = $m->{backups}[$i]{compress};
452         my $path      = "$m->{topDir}/pc/$m->{host}/$backupNum/";
453         my $legacyCharset = $m->{backups}[$i]{version} < 3.0;
454         my $sharePathM;
455         if ( $mangle ) {
456             $sharePathM = $m->{bpc}->fileNameEltMangle($share)
457                         . $m->{bpc}->fileNameMangle($dir);
458         } else {
459             $sharePathM = $share . $dir;
460         }
461         $path .= $sharePathM;
462         #print(STDERR "Opening $path (share=$share)\n");
463
464         my $dirOpts    = { %{$m->{dirOpts} || {} } };
465         my $attribOpts = { compress => $compress };
466         if ( $legacyCharset ) {
467             $dirOpts->{charsetLegacy}
468                     = $attribOpts->{charsetLegacy}
469                     = $m->{bpc}->{Conf}{ClientCharsetLegacy} || "iso-8859-1";
470         }
471
472         my $dirInfo = $m->{bpc}->dirRead($path, $dirOpts);
473         if ( !defined($dirInfo) ) {
474             #
475             # Oops, directory doesn't exist.
476             #
477             next;
478         }
479         my $attr;
480         if ( $mangle ) {
481             $attr = BackupPC::Attrib->new($attribOpts);
482             if ( !$attr->read($path) ) {
483                 $m->{error} = "Can't read attribute file in $path";
484                 $attr = undef;
485             }
486         }
487         foreach my $entry ( @$dirInfo ) {
488             my $file = $1 if ( $entry->{name} =~ /(.*)/s );
489             my $fileUM = $file;
490             $fileUM = $m->{bpc}->fileNameUnmangle($fileUM) if ( $mangle );
491             #print(STDERR "Doing $fileUM\n");
492             #
493             # skip special files
494             #
495             next if (  $file eq ".."
496                     || $file eq "."
497                     || $mangle && $file eq "attrib"
498                     || defined($files->{$fileUM}[$i]) );
499
500             my $realPath = "$path/$file";
501             from_to($realPath, "utf8", $attribOpts->{charsetLegacy})
502                             if ( $attribOpts->{charsetLegacy} ne "" );
503             my @s = stat($realPath);
504             if ( defined($attr) && defined(my $a = $attr->get($fileUM)) ) {
505                 $files->{$fileUM}[$i] = $a;
506                 $attr->set($fileUM, undef);
507             } else {
508                 #
509                 # Very expensive in the non-attribute case when compresseion
510                 # is on.  We have to stat the file and read compressed files
511                 # to determine their size.
512                 #
513                 $files->{$fileUM}[$i] = {
514                     type  => -d _ ? BPC_FTYPE_DIR : BPC_FTYPE_FILE,
515                     mode  => $s[2],
516                     uid   => $s[4],
517                     gid   => $s[5],
518                     size  => -f _ ? $s[7] : 0,
519                     mtime => $s[9],
520                 };
521                 if ( $compress && -f _ ) {
522                     #
523                     # Compute the correct size by reading the whole file
524                     #
525                     my $f = BackupPC::FileZIO->open("$realPath",
526                                                     0, $compress);
527                     if ( !defined($f) ) {
528                         $m->{error} = "Can't open $path/$file";
529                     } else {
530                         my($data, $size);
531                         while ( $f->read(\$data, 65636 * 8) > 0 ) {
532                             $size += length($data);
533                         }
534                         $f->close;
535                         $files->{$fileUM}[$i]{size} = $size;
536                     }
537                 }
538             }
539             ($files->{$fileUM}[$i]{relPath}    = "$dir/$fileUM") =~ s{//+}{/}g;
540             ($files->{$fileUM}[$i]{sharePathM} = "$sharePathM/$file")
541                                                                 =~ s{//+}{/}g;
542             ($files->{$fileUM}[$i]{fullPath}   = "$path/$file") =~ s{//+}{/}g;
543             $files->{$fileUM}[$i]{backupNum}   = $backupNum;
544             $files->{$fileUM}[$i]{compress}    = $compress;
545             $files->{$fileUM}[$i]{nlink}       = $entry->{nlink}
546                                                     if ( $m->{dirOpts}{nlink} );
547             $files->{$fileUM}[$i]{inode}       = $entry->{inode}
548                                                     if ( $m->{dirOpts}{inode} );
549         }
550
551         #
552         # Flag deleted files
553         #
554         if ( defined($attr) ) {
555             my $a = $attr->get;
556             foreach my $fileUM ( keys(%$a) ) {
557                 next if ( $a->{$fileUM}{type} != BPC_FTYPE_DELETED );
558                 $files->{$fileUM}[$i]{type} = BPC_FTYPE_DELETED;
559             }
560         }
561
562         #
563         # Merge old backups.  Don't merge directories from old
564         # backups because every backup has an accurate directory
565         # tree.
566         #
567         for ( my $k = $i - 1 ; $level > 0 && $k >= 0 ; $k-- ) {
568             next if ( $m->{backups}[$k]{level} >= $level );
569             $level = $m->{backups}[$k]{level};
570             foreach my $fileUM ( keys(%$files) ) {
571                 next if ( !defined($files->{$fileUM}[$k])
572                         || defined($files->{$fileUM}[$i])
573                         || $files->{$fileUM}[$k]{type} == BPC_FTYPE_DIR );
574                 $files->{$fileUM}[$i] = $files->{$fileUM}[$k];
575             }
576         }
577     }
578
579     #
580     # Remove deleted files
581     #
582     for ( $i = 0 ; $i < @{$m->{backups}} ; $i++ ) {
583         foreach my $fileUM ( keys(%$files) ) {
584             next if ( !defined($files->{$fileUM}[$i])
585                     || $files->{$fileUM}[$i]{type} != BPC_FTYPE_DELETED );
586             $files->{$fileUM}[$i] = undef;
587         }
588     }
589
590     #print STDERR "Returning:\n", Dumper($files);
591     return $files;
592 }
593
594
595 #
596 # Do a recursive find starting at the given path (either a file
597 # or directory).  The callback function $callback is called on each
598 # file and directory.  The function arguments are the attrs hashref,
599 # and additional callback arguments.  The search is depth-first if
600 # depth is set.  Returns -1 if $path does not exist.
601 #
602 sub find
603 {
604     my($m, $backupNum, $share, $path, $depth, $callback, @callbackArgs) = @_;
605
606     #print(STDERR "find: got $backupNum, $share, $path\n");
607     #
608     # First call the callback on the given $path
609     #
610     my $attr = $m->fileAttrib($backupNum, $share, $path);
611     return -1 if ( !defined($attr) );
612     &$callback($attr, @callbackArgs);
613     return if ( $attr->{type} != BPC_FTYPE_DIR );
614
615     #
616     # Now recurse into subdirectories
617     #
618     $m->findRecurse($backupNum, $share, $path, $depth,
619                     $callback, @callbackArgs);
620 }
621
622 #
623 # Same as find(), except the callback is not called on the current
624 # $path, only on the contents of $path.  So if $path is a file then
625 # no callback or recursion occurs.
626 #
627 sub findRecurse
628 {
629     my($m, $backupNum, $share, $path, $depth, $callback, @callbackArgs) = @_;
630
631     my $attr = $m->dirAttrib($backupNum, $share, $path);
632     return if ( !defined($attr) );
633     foreach my $file ( sort(keys(%$attr)) ) {
634         &$callback($attr->{$file}, @callbackArgs);
635         next if ( !$depth || $attr->{$file}{type} != BPC_FTYPE_DIR );
636         #
637         # For depth-first, recurse as we hit each directory
638         #
639         $m->findRecurse($backupNum, $share, "$path/$file", $depth,
640                              $callback, @callbackArgs);
641     }
642     if ( !$depth ) {
643         #
644         # For non-depth, recurse directories after we finish current dir
645         #
646         foreach my $file ( keys(%{$attr}) ) {
647             next if ( $attr->{$file}{type} != BPC_FTYPE_DIR );
648             $m->findRecurse($backupNum, $share, "$path/$file", $depth,
649                             $callback, @callbackArgs);
650         }
651     }
652 }
653
654 1;