From: Joel VanderWerf Date: 2007-09-05T06:47:59+09:00 Subject: Re: Why does File.exists? not support regexp? It would be very handfull? Gary Wright wrote: > > On Sep 4, 2007, at 12:00 PM, kazaam wrote: >> On Wed, 5 Sep 2007 00:52:57 +0900 >> Daniel Berger wrote: >> >>> Dir["fglrx*"].each{ |file| File.delete(file) } >>> >> that's pretty much the same like: system('rm -f fglrx*') but I'm >> asking why one doesn't allow regexpr into File.exists? > > I would guess it is because file name pattern matching > is subtly different from string pattern matching. In > particular you have the problem of directory hierarchies > and how to handle the separator character (typically '/'). > The common file pattern syntax is also *not* the same > as general regular expressions. The slocate(1) program does have a -r option for searching file paths with a regex, so there is some precedent. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407