$geoTiff_delete_all = ;
$zip_delete_all = ;
####
cd /tmp
touch foo1.foo foo2.foo foo3.foo
perl -le '$f=<*.foo>; print "scalar: $f"; @f=<*.foo>; print "array: @f"'
##
##
#!/usr/bin/perl
use strict;
use warnings;
use POSIX;
use Archive::Extract;
$Archive::Extract::PREFER_BIN=1;
my $basedir = '/work/locust1/swarmsdata/RasterData';
my $greendir = "$basedir/greening";
my $dekadalGet = "$greendir/dekadalGet.txt";
my $dekadalNotGet = "$greendir/dekadalNotGet.txt";
my $user = 'xxxx';
my $pass = 'xxxx';
my $timeStamp = strftime( "%Y-%m-%d %H:%M:%S", localtime());
print "\n$timeStamp ****STARTING MODIS GREENING COLLECTION ROUTINE****\n\n";
for my $typ ( 'zip', 'tif' ) {
print " -Checking dir for residual $typ file(s). \n";
my @delete_all = <$greendir/*.$typ>;
if ( @delete_all ) {
print " - $typ file(s) found purging directory. \n";
unlink @delete_all or die "$greendir/*.$typ - cannot be deleted.";
print " -Purge complete.\n\n";
}
else {
print " -No $typ file(s) found.\n";
}
}
print " -Checking dir for residual dekadalNotGet file.\n";
if ( -e $dekadalNotGet ) {
print " -dekadalNotGet file(s) found purging directory.\n";
unlink $dekadalNotGet or die "$dekadalNotGet - cannot be deleted.";
print " -Purge complete.\n\n";
}
else {
print " -No $dekadalNotGet file found.\n";
}
my ( $yr, $mo, $dy, $hr ) = ( $timeStamp =~ /(\d{4})-(\d\d)-(\d\d) (\d\d):/ );
if ( $hr eq '06' and $dy =~ /[012]1/ ) {
open( my $fh, '>', $dekadalGet ) or die "$dekadalGet: $!\n";
print $fh "$yr$mo$dy\n";
close $fh;
print " -Collection day confirmed: added '$yr$mo$dy' to collection file\n\n";
}
print " **Starting dekadal collection procedure:**\n\n";
...