Reputation: 17876
Here is my code to generate a list of files
files = FileList.new('c:/temp/**/*') do |fl|
fl.exclude("*.dll")
end
puts files
How come output still contains *.dll file? Something am I missing?
Upvotes: 0
Views: 601
Reputation: 11198
[Following DigitalRoss's answer] Or you can you a regular expresion as the pattern, see the docs. So this should work
files = FileList.new('c:/temp/**/*') do |fl|
fl.exclude(/\.dll$/)
end
puts files
Upvotes: 1
Reputation: 146053
Because the glob pattern passed to fl.exclude
is expanded against the actual file system just like the /temp
glob pattern, but it can't do the same match because it isn't a full path.
fl.exclude 'c:/temp/**/*.dll'
Upvotes: 2