On Wednesday 01 February 2006 22:42, konsu wrote: > hello, > > a related question: how to make this atomic to avoid race > conditions: > > Dir.mkdir(".timeclock") unless File.exist?(".timeclock") #################################################################### class Dir def ensure_dir(name) Dir.mkdir name rescue Errno::EEXIST raise Errno::ENOTDIR, name, caller unless File.directory?(name) end end Dir.ensure_dir ".timeclock" #################################################################### Although I'm not sure how portable that is because of Errno codes (I have tested on Linux). Regards, Stefan