remove directories also
[BackupPC.git] / bin / BackupPC_tarIncCreate
index 7704eaa..0dc5c21 100755 (executable)
@@ -252,7 +252,7 @@ sub new_tar_part {
        if ($fh) {
                return if ($current_tar_size == 0);
 
-               print STDERR " $part";
+               print STDERR "\n\t+ $part:";
 
                #
                # Finish with two null 512 byte headers,
@@ -271,6 +271,8 @@ sub new_tar_part {
 
                my $size = (stat( $file . '.tar.gz' ))[7] || die "can't stat ${file}.tar.gz";
 
+               print "$file, $size bytes, $items_in_part items";
+
                $sth_backup_parts->execute(
                        $backup_id,
                        $part,
@@ -312,7 +314,7 @@ sub new_tar_part {
                                $backup_id
                        );
 
-                       print STDERR ", $total_increment_size bytes\n" if ($opts{v});
+                       print "\n\ttotal $total_increment_size bytes";
 
                        return;
                }
@@ -331,7 +333,7 @@ sub new_tar_part {
                mkdir($tar_path) || die "can't create directory $tar_path: $!";
 
                sub abort_cleanup {
-                       print STDERR "ABORTED: cleanup temp dir";
+                       print STDERR "ABORTED: cleanup temp dir ";
                        rmtree($tar_path);
                        $dbh->rollback;
                        exit 1;
@@ -374,6 +376,13 @@ if (seedCache($Host, $ShareName, $Num)) {
        print STDERR "NOTE: no files found for $Host:$ShareName, increment $Num\n" if ($opts{v});
        # remove temporary files if there are no files
        rmtree($tar_path);
+
+       my $sth = $dbh->prepare(qq{
+               update backups set inc_size = 0, parts = 0, inc_deleted = true
+               where id = ?
+       });
+       $sth->execute($backup_id);
+
 }
 
 #