Hi Jens

one possible solution is to use the Find library

require 'find'

Find::find(path){|file|
 next if !File.basename(x).include?(".jsp")
 ## do what you need on jsp files
}

where path is the starting dir where you start the search

Don't know if it is more ruby, but for me is working quite well.

See you, Riccardo :)


Jens Riedel wrote:
> Hello,
>
> I'm quite new to Ruby.
> I'd to walk through a directory tree and edit all jsp files in there.
>
> I do it this way:
>
> def editDirectory(path)
>      Dir.entries(path).each { |filename|
>        next if filename =~ /^\.+$/
>        currFile = path + "/" + filename
>        if(File.stat(currFile).directory?)
>          editDirectory(currFile)
>        elsif(filename =~ /(.+)\.jsp$/)
>          # ... do something with the file
>        end
>      }
> end
>
> I'd like to know if there is a more professional or more "ruby-like"
way 
> to do this...
> 
> Thanx for every hint,
> Jens