From: Siep Korteling Date: 2008-01-12T08:54:42+09:00 Subject: Re: Counting the files in a directory.... Kyle Schmitt wrote: (...) > I thought that perhaps there was some sort of system call, at least in > Real OSes™ (Linux, *BSD, Unix, etc), that would return the number of > files inside of a directory. Something that would hopefully return in > a 1/4th or 1/8th a second, rather than in 4 or 8 (or 20...) seconds. > > Any clues? > > Thanks, > Kyle On Windows there is such a call. With Ruby you have to take a bit of a (known) detour to get there: require 'win32ole' fso = WIN32OLE.new("Scripting.FileSystemObject") folder = fso.GetFolder("C:/WINDOWS/system32 puts folder.Files.count regards, Siep -- Posted via http://www.ruby-forum.com/.