加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何让Ruby FileList获取没有名称的文件,比如Windows上的.htacce

发布时间:2020-12-17 03:26:08 所属栏目:百科 来源:网络整理
导读:我想在我的文件系统中搜索扩展名为.template的任何文件. 除了.htaccess.template之外,以下内容适用于所有内容 FileList.new(File.join(root,'**','*.template')).each do |file| # do stuff with fileend 因为windows不喜欢无名文件,grrrr 如何在Windows上进
我想在我的文件系统中搜索扩展名为.template的任何文件.

除了.htaccess.template之外,以下内容适用于所有内容

FileList.new(File.join(root,'**','*.template')).each do |file|
    # do stuff with file
end

因为windows不喜欢无名文件,grrrr

如何在Windows上进行此操作?这段代码在Linux上工作正常….

解决方法

怎么样

Dir.glob([".*.template","*.template"])

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读