Mark and bulk delete dup files
Mark duplicate files and delete them after comparing all the
files. This avoids the issue with opening a file for comparison
that has already been deleted.
Also making sure that duplicate files are not compared again.
@@ -32,6 +32,7 @@ sub rem_dup_decomp_files
if($verbose){
print "Comparing $file, size=$fsize, $nfile, size=$f2size\n";
}
+ next if($decompfile_info[$j]->{IS_DUP});
if($fsize == $f2size){
open(F1,$file);
my @file1 = <F1>;
@@ -59,11 +60,18 @@ sub rem_dup_decomp_files
}
close(F1);
close(F2);
- unlink($nfile) if ($rmfile==1);
+ if($rmfile == 1){
+ $decompfile_info[$j]->{IS_DUP} = 1;
}
}
}
}
+ for(my $i=0; $i<=$#decompfile_info; $i++){
+ if($decompfile_info[$i]->{IS_DUP}){
+ unlink($decompfile_info[$i]->{FNAME});
+ }
+ }
+}
# Decode the stack traces in the pio decomposition files
sub decode_stack_traces
