File Iteration


#1

Hi all…
i have folder named test in my application’s public folder .
i want to iterate that folder named test which is in public folder.
for that i tried this code it gives me error like

Errno::ENOENT

in Chat logController#chat_log
No such file or directory - /public/ACMServer_exe/ChatHistory

RAILS_ROOT: D:/Projects/inProgress/ANGACM0908/re/Task/acm_administration-31-jan-09</p so how should i iterate the folder test which is in public folder

Thanks


#2

On 3 Feb 2009, at 10:43, Newb N. wrote:

Hi all…
i have folder named test in my application’s public folder .
i want to iterate that folder named test which is in public folder.
for that i tried this code it gives me error like

What code :slight_smile: ? Dir.each, Dir.glob, Dir.entries can all be useful for
this sort of thing.

Fred


#3

try this

Dir.foreach(RAILS_ROOT + ‘/public/javascripts’) do |filename|
puts filename
end


#4

Frederick C. wrote:

On 3 Feb 2009, at 10:43, Newb N. wrote:

Hi all…
i have folder named test in my application’s public folder .
i want to iterate that folder named test which is in public folder.
for that i tried this code it gives me error like

What code :slight_smile: ? Dir.each, Dir.glob, Dir.entries can all be useful for
this sort of thing.

Fred

Dir.foreach("/ACMServer_exe") do |folder_name|

does this code is correct.
but it gives me error.
=> this folder is in public folder => ACMServer_exe

pls help me