From: Stefano Crocco Date: 2008-11-14T19:48:04+09:00 Subject: File.fnmatch? doesn't distinguish between .filename and ./filename ? I know that File.fnmatch? returns false for file names starting with a dot, unless you specify the File::FNM_DOTMATCH argument. The reason is that files starting with a dot are hidden files and so you (usually) don't want to take them into account. However, I just discovered that it also returns false for file names starting in ./ , for example ./xyz.rb. I think this behaviour is wrong: this isn't a hidden file, but a common file in the current directory. This can lead to unexpected (in my opinion) results. For example, look at this code: require 'find' Find.find('.'){|f| puts f if File.fnmatch('*.rb', f)} Since Find.find passes to the block filenames starting with ./ , no file, regardless of their extension, will be matched by fnmatch. This is not what most people expects. To make the above work, I'd either have to pass the flag File::FNM_DOTMATCH to the fnmatch (which would have the unwanted side effect of also matching hidden files) or to manually remove the leading dot from the file name. What do others think? Stefano