Help for this page

Select Code to Download


  1. or download this
    use File::Copy ; # Using for the move(); function
    
  2. or download this
    use Warnings ; # Cause we should
    
  3. or download this
    use warnings;
    use strict;
    
  4. or download this
    chdir($indir) ; # Move from current working directory to user defined 
    +directory.
    
  5. or download this
    # Move from current working directory to user defined directory.
    chdir $indir or die "Cannot chdir to '$indir' because: $!";
    
  6. or download this
        if ($match =~ /\.txt|.pgp$/i) { # Match files read to .pgp or .txt
    + ignoring others
    
  7. or download this
        if ( $match =~ /\.(?:txt|pgp)$/i ) { # Match files read to .pgp or
    + .txt ignoring others
    
  8. or download this
            $newlocate = $outdir . $match ; # Set where we want to move th
    +e files to
    
  9. 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\
    
  10. or download this
            $outdir = "_" . ($year+1900) . "\\" . ($mon+1) . "\\" ; # Buil
    +d the directory name based on date where the file is going \_2011\9\
    
  11. or download this
            $total++ ; # Increase file counter starting with 0 each time a
    + file is moved.