From: Tim Pease Date: 2009-04-22T03:46:51+09:00 Subject: Re: directory watcher, trying to match filename to directory name. On Tue, Apr 21, 2009 at 12:28 PM, Brian Wallace wrote: > I do realize this :) , but if I could at least assume that "STRING" without > the .??? is a directory, it would suffice ... Since the application will run > in Windows there's less of a chance that a file called "STRING" would be > placed into the list. > > So a RegEx that matches anything up to the '.' file extension and excludes > '.' and '..' would be enough > No regular expression required ... Dir.glob('/root/directory/*').each do |fn| next unless test(?d, fn) # your code goes here end The "test(?d, fn)" returns true if the current filename is a directory and false otherwise. Blessings, TwP