[ale] Quick Perl Q
Jonathan Rickman
jdr at xcorps.net
Tue Nov 23 21:17:50 EST 2004
> -----Original Message-----
> From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On
> Behalf Of Fletch
> Sent: Tuesday, November 23, 2004 6:10 PM
> To: Atlanta Linux Enthusiasts
> Subject: Re: [ale] Quick Perl Q
>
>
> I'd use link() (or symlink) rather than copy() unless you
> really want a duplicate file to muck with, but that's just me.
>
> lemur:/tmp/foo 724> l
> total 0
> -rw-r--r-- 1 fletch wheel 0 23 Nov 17:53 abc.EMB
> -rw-r--r-- 1 fletch wheel 0 15 Nov 12:34 def.EMB
> lemur:/tmp/foo 725> perl -MPOSIX=strftime -le
> 'for(<*.EMB>){m{(.*?)\.EMB$};unless($m=(stat$_)[9]){warn"canno
> t stat $_:
> $!\n";next}link($_,strftime("$1-%Y%m%dT%H%M%S.EMB",localtime$m
> ))||warn"cannot link $_: $!\n"}'
> lemur:/tmp/foo 726> l
> total 0
> -rw-r--r-- 2 fletch wheel 0 23 Nov 17:53 abc-20041123T175315.EMB
> -rw-r--r-- 2 fletch wheel 0 23 Nov 17:53 abc.EMB
> -rw-r--r-- 2 fletch wheel 0 15 Nov 12:34 def-20041115T123400.EMB
> -rw-r--r-- 2 fletch wheel 0 15 Nov 12:34 def.EMB
That will do the trick. Thanks. Now tell me you didn't do that off the top
of your head.
--
Jonathan
More information about the Ale
mailing list