From: Brian Schroeder Date: 2004-09-26T03:34:32+09:00 Subject: Re: Nuby: How do I find out what exception was thrown? On Sat, 25 Sep 2004 11:15:33 -0700, Roy Pardee wrote: > Greetings all, > > I'm using ruby v1.8 on winxp. I'm trying to get a script together to > delete a particular file if it exists--here it is in full: > > #------------------------------ > # KillOwnerLok.rb > # Looks for Eudora's signal file and tries to delete it. # > > FileToKill = '\\\blackula\Profiles\Laurel\Application > Data\Qualcomm\Eudora\owner.lok' > > if File.exist?(FileToKill) > puts FileToKill + " found!" > if File.delete(FileToKill) > 0 > puts "Succesfully deleted " + FileToKill + "--you should be able > to use Eudora now." > else > puts "Could not delete " + FileToKill + "for some reason--is > Eudora open?" > end > else > puts "Could not find " + FileToKill > end > > # rescue # What would go here? > #------------------------------ > > > -Roy My Guess: begin File.delete(filename) rescue e => Errno::EACCESS $stderr.puts "Could not delete" else $stderr.puts "Successfully deleted" end regards, Brian -- Brian Schræ—¦der http://www.brian-schroeder.de/