diff -ruN e-smith-backup-2.4.0.p25/root/etc/e-smith/events/actions/workstation-backup-dar e-smith-backup-2.4.0/root/etc/e-smith/events/actions/workstation-backup-dar --- e-smith-backup-2.4.0.p25/root/etc/e-smith/events/actions/workstation-backup-dar 2014-02-08 20:06:35.000000000 -0800 +++ e-smith-backup-2.4.0/root/etc/e-smith/events/actions/workstation-backup-dar 2014-02-08 20:56:33.000000000 -0800 @@ -86,7 +86,7 @@ } # create the directory mount point if it does not exist -createTree ($mntdir); +&createTree ($mntdir); # mount the backup directory my $err = &dmount($smbhost,$smbshare,$mntdir,$login,$password,$VFSType); @@ -174,17 +174,17 @@ } $report .= "Starting the backup with a timeout of ". int ($timeout/(60*60)). " hours\n"; -# expanding backup configuration file template +# Expand backup configuration file template +processTemplate ({TEMPLATE_PATH => "/etc/dar/$job.dcf"}); -processTemplate({ - TEMPLATE_PATH => "/etc/dar/$job.dcf", - }); - -# launching dar backup -if (($deleteearly eq 'true') && (($incnum == 0))) # Allow delete before backup +# If this is a new set and delete before backup is in use +# then empty target directory of any .dar files +if (($deleteearly eq 'true') && (($incnum == 0))) { - &removeTree ($setdirname); - &createTree ($setdirname); + foreach my $file (glob("$setdirname/*.dar")) + { + unlink $file or ldie("Error deleting old backup files in $setdirname : $!") + } } my $destination = ($deleteearly ne 'true') ? "$mntdir/$id/$bkname" : "$setdirname/$bkname"; @@ -199,10 +199,12 @@ if ($deleteearly ne 'true') # Not DeleteEarly so move backup to $setdirname { - if ($incnum == 0) # Create new set directory + if ($incnum == 0) # If this is a new set then empty target directory of any .dar files { - &removeTree ($setdirname); - &createTree ($setdirname); + foreach my $file (glob("$setdirname/*.dar")) + { + unlink $file or ldie("Error deleting old backup files in $setdirname : $!") + } } foreach (bsd_glob("$mntdir/$id/*.dar")) # Move the backup files to the set directory {