[ale] Quick Perl Q

Fletch fletch at phydeaux.org
Tue Nov 23 18:12:04 EST 2004


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"cannot 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

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
                      |  scary questions." -- Jules                =(___)=
                      |                                               U



More information about the Ale mailing list