From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2001-11-21T03:32:18+09:00 Subject: [ruby-talk:25933] Re: Checking if a file exists... In article , Phil Tomson wrote: >In article <8D96EDA0AC04D31197B400A0C96C148003C04752@ossex1.corp.webb.net>, >Ben Schumacher wrote: >>I was wondering if somebody had an easy way of checking if a file exists on >>a filesystem without using begin/rescue. I might be making this too >>complicated on myself, but I can't seem to find any other way. I was hopign >>there was something like a "File.exists" or similar. >> > >if FileTest.exists?("filename") > #read it >else > #it doesn't exist so don't try to read it >end > Actually, the FileTest module is mixed-in to File so you can also do: File.exists?("filename") Phil