My rails app have config folder & it have number of files & subfolders, so getting only folders in config,
I used ap below provided by awesome_print gem
> ap Dir.glob "#{Rails.root}/config/**/"
[
    [0] "/home/ray/projects/example_app/config/",
    [1] "/home/ray/projects/example_app/config/initializers/",
    [2] "/home/ray/projects/example_app/config/locales/",
    [3] "/home/ray/projects/example_app/config/environments/"
]
I have test folder inside config/locales/, It is also got by following query.
> ap Dir.glob "#{Rails.root}/config/**/**/"
[
    [0] "/home/ray/projects/example_app/config/",
    [1] "/home/ray/projects/example_app/config/initializers/",
    [2] "/home/ray/projects/example_app/config/locales/",
    [3] "/home/ray/projects/example_app/config/locales/test/",
    [4] "/home/ray/projects/example_app/config/environments/"
]
For further search for sub-folders on third level hierarchy, I will use "#{Rails.root}/config/**/**/**/"
Update:
You can try with following for windows,
irb(main):022:0> Dir.glob("D:/sd/*/")  # first hierarchy 
=> ["D:/sd/df/", "D:/sd/dff/"]   
irb(main):023:0> Dir.glob("D:/sd/*")
=> ["D:/sd/351px-Nvidia_logo.png", "D:/sd/df", "D:/sd/dff"]
irb(main):024:0> Dir.glob("D:/sd/*/*/") # second hierarchy
=> ["D:/sd/dff/ty/"]
irb(main):025:0> Dir.glob("D:/sd/*/*")
=> ["D:/sd/df/351px-Nvidia_logo2.png", "D:/sd/dff/ty"]
You can further get result by adding first and second hierarchy (commented in above) subfolders