use File::Copy ; # Using for the move(); function
####
use Warnings ; # Cause we should
####
use warnings;
use strict;
####
chdir($indir) ; # Move from current working directory to user defined directory.
####
# Move from current working directory to user defined directory.
chdir $indir or die "Cannot chdir to '$indir' because: $!";
####
if ($match =~ /\.txt|.pgp$/i) { # Match files read to .pgp or .txt ignoring others
####
if ( $match =~ /\.(?:txt|pgp)$/i ) { # Match files read to .pgp or .txt ignoring others
####
$newlocate = $outdir . $match ; # Set where we want to move the files to
####
$mday = sprintf('%02d', $mday) ; # Not used in this script, but returns a 2 digit day
$mon = sprintf('%01d', ++$mon) ; # Returns a 1 digit month until we get to 10 then use 2, not my choice.
$year = 1900 + $year ; # Returns a 4 digit year
$outdir = "_" . $year . "\\" . $mon . "\\" ; # Build the directory name based on date where the file is going \_2011\9\
####
$outdir = "_" . ($year+1900) . "\\" . ($mon+1) . "\\" ; # Build the directory name based on date where the file is going \_2011\9\
####
$total++ ; # Increase file counter starting with 0 each time a file is moved.