From: Alia Amin Date: 2002-11-08T02:05:33+09:00 Subject: Re: question about FILE::delete Hello, File.delete(filename) if FileTest.exists?(filename); hth, Alia Daniel Schnell wrote: >Hi there, > >I want to delete file(s) and to catch the error if the file(s) don't exist. >For that I can write the following code: > > pattern = "c:/WinNt/*" > num = File.delete(pattern) > if (0 == num) then > printf("%s: could not delete file(s) %s\n", ARGV[0], pattern) > end > >The problem is that there is a runtime error, if there are no valid files. >In the online documentation I can't find a hint about the File::delete() >method throws an exception or not. If not how can I find out, if the files >given by "pattern" do exist ? > > >Thanks in advance, > >Daniel. > > > > > >