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
?