Is there any way in Ruby where I can do a global search for a given file?
I tried Dir.glob
but it searches in the current directory. And for the Find
module I need to pass a list of directories to search. In my case, I need to search for a particular file which might be in any directory.
How can I do this in Ruby?
Find
recurses into subdirectories, so just start at the root path, it'll go everywhere:
Find.find('/') do |path|
# look for your filename
end