> I think Eivind's solution definitely has some merit, perhaps it's just a
> simple bug that needs to be fixed. I'll look at it tonight.

Well, it really wont, because

if FileTest.directory? filename

is going to throw up on a plain text file. We are, after all,
processing the textfile output of ls -R

Where Eivind is correct is the way the function calls itself. I think
changing

if FileTest.directory? filename

to something like

if x =~ /.*:$/

might work. Then again, the real problem still isn't solved.