From: Brian Wallace Date: 2009-04-22T04:12:37+09:00 Subject: Re: directory watcher, trying to match filename to directory name. --00151750d9e0bfbfff0468156d07 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Tim, This was my original idea, however this returns the full pathname - when I only need actual directory name to be able to form the array of glob patterns.. If I could figure out how this would return just the children directory names of ('/root/directory'), this would be the perfect solution. Thanks again for all your attention, I've already learned so much. Brian On Tue, Apr 21, 2009 at 2:46 PM, Tim Pease wrote: > 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 > > --00151750d9e0bfbfff0468156d07--