Ruby 遍历目录
- 作者: 2015小纯洁
- 来源: 51数据库
- 2022-08-12
require 'find' def fileWalk(path) Find.find(path) do |f| type = "File" if File.file?(f) type = "Dir " if File.directory?(f) if type != "File" && type != "Dir " type = " ?" end puts "#{type}: #{f}" end end fileWalk('C:\Ruby\doc') #put whatever folder here
推荐阅读