1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| #!/usr/local/bin/perl
# http://search.cpan.org/~leocharre/PDF-Burst-1.20/lib/PDF/Burst.pod
# http://search.cpan.org/~ssimms/PDF-API2-2.019/lib/PDF/API2.pm
use strict;
use warnings;
use PDF::API2;
use CAM::PDF;
use PDF::Burst ':all';
my $chemin_Scans_recus='./Scans_recus/';
opendir PAI, $chemin_Scans_recus or die "Impossible d'ouvrir le répertoire Scans_recus";
my @Scans_recus = grep { !/^\.\.?$/ } readdir (PAI);
my $flag = 0;
my ($pdf_1, $pdf_2);
my $date_1;
my $date_2;
my $abs_pdf_paire;
my @NF_paire;
my $abs_pdf_impaire;
my @NF_impaire;
my @date_1;
my @date_2;
foreach my $pdf(@Scans_recus) {
if ($flag == 0) {
#($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $block) = stat $pdf;
@date_1 = stat "$chemin_Scans_recus/$pdf";
$date_1 = $date_1[9];
#$date_1 = $mtime;
$pdf_1 = $pdf;
}
if ($flag == 1) {
#($dev2, $ino2, $mode2, $nlink2, $uid2, $gid2, $rdev2, $size2, $atime2, $mtime2, $ctime2, $blksize2, $block2) = stat $pdf;
@date_2 = stat "$chemin_Scans_recus/$pdf";
$date_2 = $date_2[9];
#$date_2 = $mtime2;
$pdf_2 = $pdf;
next;
}
$pdf='';
$flag++ ;
}
if ($date_1 > $date_2) {
$abs_pdf_paire = $pdf_2;
@NF_paire = pdf_burst("$chemin_Scans_recus/$abs_pdf_paire", 'paire' );
$abs_pdf_impaire = $pdf_1;
@NF_impaire = pdf_burst("$chemin_Scans_recus/$abs_pdf_impaire", 'impaire' );
}
else {
$abs_pdf_paire = $pdf_1;
@NF_paire = pdf_burst("$chemin_Scans_recus/$abs_pdf_paire", 'paire' );
$abs_pdf_impaire = $pdf_2;
@NF_impaire = pdf_burst("$chemin_Scans_recus/$abs_pdf_impaire", 'impaire' );
} |