From: Harry Nash Date: 2009-03-02T00:07:01+09:00 Subject: Re: How to use the Dir class, search for a sub directroy Thanks for your reply, I had read the doc but could not get it to work This is what I wound up doing and it does work. Dir.chdir("e:/foldertest") artist = 'Abba' artist_check = Dir.glob("#{artist}", File::FNM_CASEFOLD) puts artist_check if "#{artist}" != "#{artist_check}" puts "no match found" else puts "found match" end badboy wrote: > Harry Nash schrieb: >> Dir.chdir("e:/music") >> Dir["#{artist}"] >> >> I tried a number of things here, I need a positive or negitave >> return; and, how to get the return value. >> >> OH >> Is there a way to mark a post as answered? > try this: > artist = 'ABBA' > Dir.glob("*#{artist}*", File::FNM_CASEFOLD) > the * means anything before and after your search string, FNM_CASEFOLD > => case insensitive > this could be easily found out by reading the rdoc at: > http://www.ruby-doc.org/core/classes/Dir.html#M002347 > http://www.ruby-doc.org/core/classes/File.html#M002603 -- Posted via http://www.ruby-forum.com/.