Compare commits
No commits in common. "e4c489ce8fa76c385b4426be393a7cb8dbff07ff" and "bd7393310542e1de4b59f21259b4bd8d68424058" have entirely different histories.
e4c489ce8f
...
bd73933105
|
@ -6,7 +6,7 @@ finddup - yet another tool for finding duplicates
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
use v5.20;
|
use v5.10;
|
||||||
no autovivification 'fetch';
|
no autovivification 'fetch';
|
||||||
use File::Find;
|
use File::Find;
|
||||||
use File::stat;
|
use File::stat;
|
||||||
|
@ -25,17 +25,17 @@ find(sub {
|
||||||
unless ($files->{$size}{$hash}) {
|
unless ($files->{$size}{$hash}) {
|
||||||
$files->{$size}{$hash} = [];
|
$files->{$size}{$hash} = [];
|
||||||
}
|
}
|
||||||
push $files->{$size}{$hash}->@*, { path => $File::Find::name,
|
push $files->{$size}{$hash}, { path => $File::Find::name,
|
||||||
size => $size,
|
size => $size,
|
||||||
dev => $st->dev,
|
dev => $st->dev,
|
||||||
ino => $st->ino,
|
ino => $st->ino,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
$dir
|
$filesdir
|
||||||
);
|
);
|
||||||
|
|
||||||
for my $size (keys $files->%*) {
|
for my $size (keys $files) {
|
||||||
if (@{ $files->{$size}{""} } == 1) {
|
if (@{ $files->{$size}{""} } == 1) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -46,14 +46,16 @@ for my $size (keys $files->%*) {
|
||||||
unless ($files->{$size}{$hash}) {
|
unless ($files->{$size}{$hash}) {
|
||||||
$files->{$size}{$hash} = [];
|
$files->{$size}{$hash} = [];
|
||||||
}
|
}
|
||||||
push $files->{$size}{$hash}->@*, $file;
|
push $files->{$size}{$hash}, $file;
|
||||||
}
|
}
|
||||||
delete $files->{$size}{""};
|
delete $files->{$size}{""};
|
||||||
}
|
}
|
||||||
for my $hash (keys $files->{$size}->%*) {
|
for my $hash (keys $files->{$size}) {
|
||||||
if (@{ $files->{$size}{$hash} } > 1) {
|
if (@{ $files->{$size}{$hash} } > 1) {
|
||||||
while (my ($i, $file) = each @{ $files->{$size}{$hash} }) {
|
for my $file (@{ $files->{$size}{$hash} }) {
|
||||||
say "$i: $file->{path}";
|
unless ($st->dev == $file->{dev} && $st->ino == $file->{ino}) {
|
||||||
|
say "$file->{path}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
say "";
|
say "";
|
||||||
}
|
}
|
||||||
|
@ -62,3 +64,4 @@ for my $size (keys $files->%*) {
|
||||||
|
|
||||||
|
|
||||||
# vim: tw=132 sw=4 expandtab
|
# vim: tw=132 sw=4 expandtab
|
||||||
|
|
||||||
|
|
14
finddup2
14
finddup2
|
@ -6,7 +6,7 @@ finddup - yet another tool for finding duplicates
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
use v5.20;
|
use v5.10;
|
||||||
no autovivification 'fetch';
|
no autovivification 'fetch';
|
||||||
use File::Find;
|
use File::Find;
|
||||||
use File::stat;
|
use File::stat;
|
||||||
|
@ -25,11 +25,11 @@ find(sub {
|
||||||
unless ($haystack->{$size}{$hash}) {
|
unless ($haystack->{$size}{$hash}) {
|
||||||
$haystack->{$size}{$hash} = [];
|
$haystack->{$size}{$hash} = [];
|
||||||
}
|
}
|
||||||
push $haystack->{$size}{$hash}->@*, { path => $File::Find::name,
|
push $haystack->{$size}{$hash}, { path => $File::Find::name,
|
||||||
size => $size,
|
size => $size,
|
||||||
dev => $st->dev,
|
dev => $st->dev,
|
||||||
ino => $st->ino,
|
ino => $st->ino,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
$haystackdir
|
$haystackdir
|
||||||
|
@ -50,7 +50,7 @@ find(
|
||||||
unless ($haystack->{$size}{$hash}) {
|
unless ($haystack->{$size}{$hash}) {
|
||||||
$haystack->{$size}{$hash} = [];
|
$haystack->{$size}{$hash} = [];
|
||||||
}
|
}
|
||||||
push $haystack->{$size}{$hash}->@*, $file;
|
push $haystack->{$size}{$hash}, $file;
|
||||||
}
|
}
|
||||||
delete $haystack->{$size}{""};
|
delete $haystack->{$size}{""};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue