def get_file_list(path)
Dir.entries(path).each do |sub|
if sub != '.' && sub != '..'
if File.directory?("#{path}/#{sub}")
puts "[#{sub}]"
get_file_list("#{path}/#{sub}")
else
puts " |--#{sub}"
end
end
end
end
ruby遍历文件夹
点亮测试人生!QQ:408129370
百度阅读电子书地址:http://yuedu.baidu.com/ebook/f6dbb2a2f01dc281e53af0f3
讨论QQ群:536192476
个人公众号:
百度阅读电子书地址:http://yuedu.baidu.com/ebook/f6dbb2a2f01dc281e53af0f3
讨论QQ群:536192476
个人公众号: