From: nobuyoshi nakada Date: 2005-11-22T17:58:34+09:00 Subject: Re: class Dir Hi, At Tue, 22 Nov 2005 17:52:23 +0900, Alexander Fleck wrote in [ruby-talk:166951]: > what' s the best way to detect if a Dir entry is a directory or file? I' m doing a Dir.foreach blabla |x|. > I' m trying to use 'directory?', but it doesn' t work the way I use it. Dir.foreach yields just basenames. You'll need to prefix the directory name to them. Dir.foreach(blabla) {|x| x = File.join(blabla, x); p x if File.directory?(x)} Or, Dir.glob(File.join(blabla, "*/")) returns an array of the directories. -- Nobu Nakada