views:

20

answers:

1

I have a file hierarchy and some of the sub-directories are relative symlinks. I am using Ruby's Find.find to crawl through these dirs and find some specific files. However it's not looking into any directory which is a symlink (it follows files which are symlinks).

Looking at the source code it seems the problem is because it's using File.lstat(file).directory? to test if something is a directory. This returns false for symlinks but File.stat.directory? returns true.

How can I make Find.find follow symlinks, short of monkey patching it to use File.stat instead of File.lstat?

A: 

why not use Dir instead ? It follows symlinks Or you can try alib

To make Dir find files recursively, try double asterix Dir["**/*"]

ghostdog74
How do I make `Dir` find files recursively? I don't see a method in the Dir class - am I missing something here?
arnab
While "alib" seems to have similar code, I have never heard of it - it's not on github/gemcutter and the name itself (is it really "a lib") doesn't inspire much confidence. Have you used it in production code? How was the experience?
arnab