Getting list of files in a directory WITHOUT paths in Ruby
(I can't believe how long I've spent on this so I'm just gonna ask it...)
Given a directory path, how do I get the list of the file names underneath
it excluding the path prefix. Yeah I could strip them off but I feel like
I'm missing a cleaner way?
Specifically, I want all the files under the /config directory in Rails:
files = Dir[Rails.root.join("config").to_s + "/*"]
files = Dir.glob(Rails.root.join("config").to_s + "/*")
Each of these returns full-path file names...
No comments:
Post a Comment