-#!/bin/perl
+#!/usr/bin/perl
#============================================================= -*-perl-*-
#
# BackupPC_nightly: Nightly cleanup & statistics script.
# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
-# Copyright (C) 2001-2004 Craig Barratt
+# Copyright (C) 2001-2009 Craig Barratt
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
#========================================================================
#
-# Version 3.0.0beta3, released 3 Dec 2006.
+# Version 3.2.0, released 31 Jul 2010.
#
# See http://backuppc.sourceforge.net.
#
use strict;
no utf8;
use lib "/usr/local/BackupPC/lib";
-use BackupPC::Lib;
+use BackupPC::Lib qw( :BPC_DT_ALL );
use BackupPC::FileZIO;
use Getopt::Std;
-use File::Find;
use File::Path;
use Data::Dumper;
$fileLinkMax = 0;
$fileCntRename = 0;
%FixList = ();
- find({wanted => \&GetPoolStats}, "$TopDir/$pool/$dir")
+ $bpc->find({wanted => \&GetPoolStats}, "$TopDir/$pool/$dir")
if ( -d "$TopDir/$pool/$dir" );
my $kb = $blkCnt / 2;
my $kbRm = $blkCntRm / 2;
sub GetPoolStats
{
- my($inode, $nlinks, $nblocks) = (lstat($_))[1, 3, 12];
+ my($file, $fullPath) = @_;
+ my($inode, $nlinks, $nblocks) = (lstat($file))[1, 3, 12];
if ( -d _ ) {
$dirCnt++;
# pool files vs removing pool files. (Other aspects of the
# design should eliminate race conditions.)
#
- my $fullPath = $File::Find::name;
push(@PendingDelete, {
inode => $inode,
path => $fullPath
$fullPath =~ s/_\d+$//;
$FixList{$fullPath}++;
} else {
- if ( /_(\d+)$/ ) {
+ if ( $file =~ /_(\d+)$/ ) {
$fileRepMax = $1 + 1 if ( $fileRepMax <= $1 );
$fileCntRep++;
}