[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Quick Perl Q
- Subject: [ale] Quick Perl Q
- From: fletch at phydeaux.org (Fletch)
- Date: Tue Nov 23 18:12:04 2004
- In-reply-to: <[email protected]> (Jonathan Rickman's message of "Tue, 23 Nov 2004 15:55:05 -0500")
- References: <[email protected]>
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