5 use Koha
::Script
-cron
;
8 # this script will remove those older than 5 days
11 opendir( my $dh, $tmpdir) || die "Cannot open $tmpdir : $!";
13 my @files_in_tmp = grep { /\.CE[IQ]$/ && -f
"$tmpdir/$_" } readdir($dh);
17 my $dbh = C4
::Context
->dbh;
19 my $query =<<'ENDSQL';
20 select filename from edifact_messages
21 where message_type IN ('QUOTE','INVOICE')
22 and datediff( CURDATE(), transfer_date ) > 5
27 @
{$ingested} = $dbh->selectcol_arrayref($query);
29 my %ingested_hash = map { $_ => 1 } @
{$ingested};
33 foreach (@files_in_tmp) {
34 if ( exists $ingested_hash{$_} ) {
35 push @delete_list, $_;