Dir.glob not working on site hosted on site5?

I have uploaded several files to a public directory and I am trying to access them using Dir.glob. But I don't get results.

Dir.glob works great on dev server (mongrel) and also works great when using script / console on site set on site

Is there a way to get this working, or another way to get the list of files?

0


source to share


2 answers


I am assuming that shell execution is prohibited by site5 or you do not have access to / bin / sh. Globbing is usually implemented by running a shell ... Try



Dir.entries("public").each do |f|
  puts(f)
end

      

+1


source


It turns out that glob is allowed, but on mongrel I need to prefix the path publicly, whereas on a site hosted by site5 I need to skip it.

valid in mongrel:

Dir.glob('public/files/images/*.jpg')

      



operates on the site5:

Dir.glob('files/images/*.jpg')

      

The Ollivers will answer that I am on the right track.

0


source







All Articles