1

是否有 GNU find 或 PERL 的 File::Find 在 Ruby 中的等价物,也许是宝石?也就是说,横穿整棵树。谢谢,

4

2 回答 2

3

Stdlib offers both Dir#glob and the Find module. Coupled with Enumerable methods and the plethora of file test methods, this gives you all you need to simply implement file find behaviour.

于 2013-03-19T15:24:07.763 回答
1

You can use Dir.glob

Dir.glob "**/*" do |file_path|
    #do somthing with file_path
end
于 2013-03-19T15:23:36.587 回答