Directory structure

Trying to get the files in a directory structure to be read into a
variable. Just playing around right now but would like it so that each
file read gets entered into a database. Trying to read a folder of music
files. I put the folder in the public folder along with the images, and
stylesheet. Added this code to my controller:

@files = Dir['/public/music/']
@mp3 = @files.select{ |my_file| /(mp3|MP3)$/ =~ my_file }

And added thsi code to my view:

<%= @mp3.select{ |file| /(mp3|MP3)$/ =~ file } %>

but nada. Any suggestions? Where do I put the folder. If it is in my
puiblic folder, am I referencing it right in my view? Thanks

-Shandy

@files = Dir['/public/music/']

just guessing, but one possible reason this isn’t working is the path
from the controller is relative to the ‘app’ path … something like
this should work (extremely untested):

@files = Dir[ RAILS_ROOT + ‘/public/music’ ]

anyway, the problem lies within.

@files = Dir[ RAILS_ROOT + ‘/public/music’ ]

I have tried that and what I get back is ‘[].’ I assume that means that
its not finding anything in the directory even though there is stuff
there.