69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/it_tools/pub_driver.rb', line 69
def count_files_in_dir options, dirs, extension = []
file_count = {}
ext_count = {}
dirs.each do |dir|
file_count[dir] = Dir.entries(options[dir]).size - 2
next unless extension.size > 0
files_with_extension_count = {}
extension.each do |curr_ext|
ext_count[curr_ext] = 0
end
Dir.entries(options[dir]).each do |file|
full_path = File.join options[dir], file
next unless File.exists? full_path
next if File.directory? full_path
extension.each do |curr_ext|
if (File.extname file) == curr_ext
ext_count[curr_ext] += 1
end
end
end
return [file_count,ext_count]
end
end
|