From: Dave Burt Date: 2005-09-08T06:26:28+09:00 Subject: Re: FileTest.directory?( x ) weird behavior The reason for the behaviour you're getting is that those filenames don't exist in the current working directory, only in the @userFilePath directory - that's why directory? is returning false. > You're testing relative file names only while you want absolute file > names: > > def GetFolders > rtn = "" > Dir.foreach( @userFilePath ) do |x| > if FileTest.directory?( File.join( @userFilePath, x ) ) > rtn << "" unless x <= ".." end > end > return rtn > end Or you can change directory: #... Dir.chdir( @userFilePath ) do Dir.foreach (@userFilePath ) do |x| #... end end #... Cheers, Dave