Uninitialized constant Object::Files (NameError)

Hello,
I’m new to ruby. Could anyone please help to resolve the compilation
error as per below :

C:\Ruby\MyWork>ruby test1.rb
test1.rb:2:in block in <main>': uninitialized constant Object::Files (NameError) from test1.rb:2:inforeach’
from test1.rb:2:in `’

Please see attach file as my ruby code.

Or see below code

dir = “C:\Calls”
puts Dir.foreach(dir) {|f| Files.ctime(f)}

I want to get change time of all the directory which is in mention
directory.

But getting “uninitialized constant Object” error.

Please help !!

Thanks in advance
Raju

the class is named File not Files

Hans M. wrote in post #1010093:

the class is named File not Files

Thanks a lot Hans !!

My program is working fine now.

Done update Files.ctime to File.ctime

dir = “C:\Calls”
puts Dir.foreach(dir) {|f| File.ctime("#{dir}\#{f}")}

raju sathliya wrote in post #1010099:

dir = “C:\Calls”

Never use backslashes in directory names when programming with ruby. A
forward slash is always correct, no matter what OS the program runs on.