> I am not a unix guy but have to get this thing working.
Whether you're a Unix guy, NT gal, Mac dog or VMS frog, you've to read manuals
and learn howto do things yourself ;)
Quote:> I have a Sun
> Box & want to automatically rename a file as soon as it is created in
> the specified directory. The name has to be a unique filename
> identified by creation date/time.
I'd use this - You can get the PID of the process that's creating the file
from a shell by using "$$", and get the number of seconds since Jan. 1st 1970
using date '+s' (I think that's what it does...), so a command like
touch foobar.$$.`date '+%s'`
should create a unique filename, in the example which I just tried out on my
workstation, I got this file created.
foo.23097.946046140
Seems pretty unique to me - Unless you happen to spawn off tens of thousands
of new processes in a second on your machine, I reckon you're safe enough.
Hope this helps :)
Brian.
--
Horizon Open Systems Ltd. http://www.hos.horizon.ie
East Point Business Park Tel:+353-1-805-5700
Dublin 3, Ireland Fax:+353-1-805-5601
Sent via Deja.com http://www.deja.com/
Before you buy.