From: Stefan Lang Date: 2005-08-01T18:26:35+09:00 Subject: Re: [rake] excluding dirs with FileList On Monday 01 August 2005 05:39, Ezra Zygmuntowicz wrote: > On Jul 31, 2005, at 6:13 PM, Joel VanderWerf wrote: > > How can I construct a FileList that excludes dirs? Not a > > particular directory, but _any_ directory? > > > > I had hoped that #exclude could be passed an object whose #=== > > method returned true for a dir (using File#directory?). But > > #exclude tries to turn its argument into a string and build up a > > regex. > > > > -- > > vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 > > require 'find' > > file_list = [] > start_path = "/path/to/directory/" <= the dir to start recursing > from. > > Find.find(start_path) do |file| > file_list << path unless test(?d, file) > end > > p file_list > > This works unless I misunderstand what you are trying to do. Sorry if this sounds like bad advertisement, but with Rant the same looks like: file_list = sys["/path/to/directory/**/*"].no_dir Perhaps someone wants to integrate it into Rake. HTH, Stefan