R
rishid
Hi,
I found some code on here to find duplicate file names, but cannot
figure out how to add a check to make sure the file size is also the
same then only add it to the duplicates hash.
Here is the code, thanks for any help.
find (\&check_file, $dir)
sub check_file {
if (-d $_) { next; }
else
{
if ($seen{$_})
{
if (exists $duplicates{$_})
{
push (@{$duplicates{$_}}, $File::Find::name);
}
else
{
$duplicates{$_} = [$seen{$_}, $File::Find::name];
}
}
else
{
$seen{$_} = $File::Find::name;
}
}
}
I found some code on here to find duplicate file names, but cannot
figure out how to add a check to make sure the file size is also the
same then only add it to the duplicates hash.
Here is the code, thanks for any help.
find (\&check_file, $dir)
sub check_file {
if (-d $_) { next; }
else
{
if ($seen{$_})
{
if (exists $duplicates{$_})
{
push (@{$duplicates{$_}}, $File::Find::name);
}
else
{
$duplicates{$_} = [$seen{$_}, $File::Find::name];
}
}
else
{
$seen{$_} = $File::Find::name;
}
}
}