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)
Using ~/Documents as example.
~/Documents
One line code:
Dir['~/Documents'].length
For longer paths one line can be less readable, so:
path = '~/Documents/foo/bar'
Dir[path].length