From: "Peña, Botp" Date: 2008-03-14T18:04:52+09:00 Subject: Re: check if file exists for part of the filename [mailto:list-bounce@example.com] On Behalf Of Christian Kerth # How do i check if a file exists, that starts with a certain # identifier? # e.g. Files in Directory # file_1.rb # file_2.rb # test_1.rb # I only want to know if a file exists, that starts with "file_" there are many ways. these are just some... Dir.glob("file_*.rb").empty? #=> false Dir.glob("file_*.rb").size>0 #=> true Dir.glob("file_*.rb") #=> ["file_1.rb", "file_2.rb", "file_3.rb"] File.exist? "file_1.rb" #=> true File.exist? "file_2.rb" #=> true File.exist? "file_4.rb" #=> false kind regards -botp