views:

153

answers:

2

Hi, I have uploaded some files to a directory under public and I try to access them using Dir.glob. But I get no results back.

The Dir.glob works fine on dev server (mongrel) and also works fine when using script/console on the site installed on site5

is there a way to get this working or a different way to get the list of files?

+1  A: 

My guess is that executing a shell is prohibited by site5 or that you don't have access to /bin/sh. Globbing is generally implemented by running a shell... Try

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

Turns out that glob is allowed, but on mongrel I need to prefix the path with public whereas on the site hosted by site5 I need to skip it.

valid in mongrel:

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

valid in site5:

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

Olliviers answer put me on the right track though.

AndreasKnudsen