[ale] Quick Perl Q

Geoffrey esoteric at 3times25.net
Tue Nov 23 17:00:06 EST 2004


Jonathan Rickman wrote:
> -------------------------
> #!/usr/bin/perl -w
> 
> use strict ;
> use POSIX ;
> use File::Copy ;
> use File::Basename ;
> use File::stat ;
> 
> 
> chdir "/vm1/share/users/cl"
>    or die "BZZZT $!\n" ;
> 
> for my $file (<*.EMB>)
>   { my ($name,$path,$suffix) = fileparse($file,"\.EMB") ;
>     my $mod = (stat $file)[9];
>     my $datestamp = strftime("-%Y%m%d-%H%M%S",localtime($mod)) ;
>     copy $file,"/vm1/share/users/cl/$name$datestamp$suffix"
>       or warn "Cannot copy $file $!\n" ;
>   }
> --------------------------

I'll shutup after this.  I've played a bit with this, I would say stat() 
is not locating the file, thus it returns 0, hence localtime(0) will 
return epoch. Print the value of $mod out.

-- 
Until later, Geoffrey



More information about the Ale mailing list