>>>>> "D" == Daniel Schnell <daniel.schnell / embeddedware.de> writes:

D>     pattern = "c:/WinNt/*"
D>     num = File.delete(pattern)

 File::delete don't take a pattern but just a filename

pigeon% ls
a  b  c
pigeon% 

pigeon% ruby -e 'File.delete("*")'
-e:1:in `delete': No such file or directory - "*" (Errno::ENOENT)
        from -e:1
pigeon% 

 Now to catch the error

pigeon% ruby -e 'File.delete("*") rescue p "ERROR #$!"'
"ERROR No such file or directory - \"*\""
pigeon% 

 and if you want to delete all files

pigeon% ruby -e 'Dir["*"].each {|f| File.delete(f) }'
pigeon% 

pigeon% ls
pigeon% 

 Just protect File::delete in the block {} if you want catch the error



Guy Decoux