Ruby - Pathname.glob - 匹配隐藏和非隐藏文件

时间:2014-05-23 08:12:56

标签: ruby

我使用 Pathname.glob 来匹配文件。

Pathname.glob("**/*")仅匹配非隐藏文件

Pathname.glob("**/.*")仅匹配隐藏文件

有没有办法匹配两者?

您的帮助将不胜感激!

1 个答案:

答案 0 :(得分:3)

Pathname.glob("**/*", File::FNM_DOTMATCH)

来源:http://www.ruby-doc.org/core-2.1.2/Dir.html#method-c-glob