Hmm, starting with half yielded only ("copies", 74), checking all files against all files yields ("copies", 847) leaving only 1200 files / 6.54MB , thats less than the nulls 8MB, hmmm, have I eliminated data or actually lost it?
...
use constant NAME => 0;
use constant SIZE => 1;
use constant VALU => 2;
use constant COPY => 3;
my @files = sort {
$$a[SIZE()] <=> $$b[SIZE()]
} map {
[
$_,
path($_)->stat->size,
path($_)->slurp_raw,
];
} glob 'myfinalmaybeit/*';
my @half = @files;
my $copies=0;
for my $half ( @half ){
for my $file ( @files ){
if( $half != $file ## cause self will match self
and
$file->[VALU] =~ m{\Q$half->[2]\E}
){
$copies++;
push @{ $half->[COPY] }, $file->[NAME];
}
}
}
@files = sort {
$$a[NAME()] cmp $$b[NAME()]
} @files;
$_->[VALU]=undef for @half, @files;
dd( @files );
dd( 'copies', $copies );
path('myfinalmaybeit1k')->mkpath;
for my $file ( @files ){
my $ref = $file->[ 3 ] ;
if( not defined $ref or not @{ $ref } ){
path( $file->[0] )->copy('myfinalmaybeit1k/');
}
}
__END__
| [reply] [d/l] |