using ruby how to get number of files in a given Directory,the file count should include count from recursive directories.
Eg: folder1(2 files) -----> folder2(4 files)
The fastest way should be (not including directories in count):
Dir.glob(File.join(your_directory_as_variable_or_string, '**', '*')).select { |file| File.file?(file) }.count
And shorter:
dir = '~/Documents' Dir[File.join(dir, '**', '*')].count { |file| File.file?(file) }