Dir.foreach(root) do |file|
next if file == ?.
traverse(root + ‘\’ + file) if File.directory?(root + ‘\’ + file)
This is my initial attempt. Two things feel rather wrong:
- Is there a simpler way to test the beginning of a string? A
startsWith?(aString) like method?
- I’m iterating through filenames, then appending the path each time.
Is there a way to get a
collection of File objects from a directory?
Any other pointers to where I could improve would also be greatly
(I tried posting this twice through Teranews, but it doesn’t seem to
have got through.)