> File.unlink(filename) rescue nil > > However this catches everything under StandardError (I > think), including > NoMethodError. So if you type > > File.unlikn(filename) rescue nil > > then you won't see the typo. Interesting (didn't know about this variation), but, as you said, too risky, as typos would be ignored too. > > def silent_unlink(f) > > File.unlink(f) if File.exist?(f) > > end > > ... > > silent_unlink(filename) > > FYI, that code has a "race" - the existence of a file may > change between the > test and the unlink. So this code *may* raise an exception, very > occasionally. Thank you for pointing this out. You are very right. Ronald