Can I traverse symlinked directories in Ruby with a “**” glob?

后端 未结 2 1660
南旧
南旧 2020-12-14 17:27

In Ruby, Dir.glob(\"**/*.rb\") (for instance) doesn\'t traverse symlinked directories. Is it possible to get the ** to traverse symlinks?

2条回答
  •  攒了一身酷
    2020-12-14 18:19

    Normally not with recursive search due to the risk of infinite loops.

    But, this discussion may help:

    Dir.glob("**/*/**/b") will follow a symlink up to once.

提交回复
热议问题