To get all files (strictly files only) recursively:
Dir.glob('path/**/*').select { |e| File.file? e }
Or anything that's not a directory (File.file?
would reject non-regular files):
Dir.glob('path/**/*').reject { |e| File.directory? e }
Using Find#find
over a pattern-based lookup method like Dir.glob
is actually better. See this answer to "One-liner to Recursively List Directories in Ruby?".