From: Phillip Gawlowski Date: 2010-12-23T22:40:37+09:00 Subject: Re: simple counting in Ruby On Thu, Dec 23, 2010 at 2:35 PM, Peter Bailey wrote: > Hello, > Can someone please tell me how to get a count for the number of files in > a directory? > Example: > files = Dir.glob("*.pdf") > puts files.count ?? > > That doesn't work, but, I'd love to know what would work. You can interrogate "files" as to what it is, and / or what methods it accepts: files.class files.methods.sort Then you can check Ruby's documentation (or remember off the top of your head ;) ) what other method would be appropriate (if any). -- Phillip Gawlowski Though the folk I have met, (Ah, how soon!) they forget When I've moved on to some other place, There may be one or two, When I've played and passed through, Who'll remember my song or my face.