PERL: Copy Files Changed Yesterday
After mangling several batch files and bastardizing a few other scripts I decided it was time to delve into PERL. I have been wanting to learn PERL for quite some time now and finnnaly wrote my first script today… Here it is in all its glory…
c:\perl\bin\perl.exe
Created on 9/15/2005 - Mike M
use File::Copy;
$dir=”c:\htrdata\keene1″;
$destdir=”\\cifp01\pubworks\wwtp\ZETABACKUP”;
opendir(MY_DIR, $dir) || die(”I can’t OPEN IT!”);
@files= readdir(MY_DIR);
closedir(MY_DIR);
foreach $f (@files)
{
$age=int(-M $dir."\\".$f);
if($age == 1) {
#print "$f $age\n";
copy($dir."\\".$f,$dest_dir."\\\\".$f) or die "Copy Failed!";
}
}
-mwm