How to find every “.conf” file on a computer using ruby

Viewed 81

I am a new learner in scripting languages. I want to display all the .conf files in the computer using ruby. I have written the below code, however, its not printing anything.

Dir.glob("**/*.conf") {|file| puts file}

What am I doing wrong?

1 Answers

You're almost there. Your code will show you all the conf files, but it will start checking in the folder where you're currently located, not the whole computer. To achieve that, try with:

Dir.glob("/**/*.conf") {|file| puts file}
Related