> -----Original Message----- > From: frank.cameron / gmail.com > [mailto:frank.cameron / gmail.com] On Behalf Of brabuhr / gmail.com > Sent: Tuesday, May 23, 2006 3:18 PM > To: ruby-talk ML > Subject: Re: Atomic File.copy from Linux to Windows shared drive > > > > require 'ftools' > > require 'timeout' > > > > begin > > Timeout.timeout(3){ > > File.copy('temp.txt', 'temp.bak') > > File.rename('temp.bak', '/X/temp.txt') > > File.unlink('temp.bak') > > } > > rescue Errno::EPERM > > # Ignore bogus EPERM errors - harmless > > end > > > > The problem is that File.rename is raising Errno::EXDEV errors, and > > simply ignoring those won't work. > > Shouldn't it be: > File.copy('temp.txt', '/X/temp.bak') > File.rename('/X/temp.bak', '/X/temp.txt') Whoops! Yeah, that worked. I still don't know what will happen if the share goes down, though. Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.