#!/usr/bin/perl
my $directory="folder_of_files";
my %Filehash
open DIR, "ls -t $directory" || die "Uanble to open '$directory' for listing:$!\n";
while (<DIR>) {
chomp();
if ( /^([A-Za-z0-9\-]+\.[a-z]+)_p443\-(\d+)\-(\d*)\.csv/ )
$filehash{$1}->{"$2-$3"}=$_;
}
}
You can use different check sum related tools.
Checksum type could be easier, get a digest of each file, and then delete
The diff is a comparison of files...but this will mean you compare files to each other, which .......