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