From: rtilley Date: 2006-03-22T06:38:50+09:00 Subject: Re: Find.find and files in cwd zdennis wrote: > To get only normal files try: > Dir["*"].delete_if{ |e| not File.file?( e ) } > > To get only directories try: > Dir["*"].delete_if{ |e| not File.directory?( e ) } > > To get only links try: > Dir["*"].delete_if{ |e| not File.link?( e ) } > > Zach The whole thing seems a bit hackish to me and it still leaves links to files and links to folders on my Windows test machine. I like this: contents = Dir.entries(Pathname.getwd) Better than this: contents = Dir["#{Dir.getwd}/*"] It makes more sense to me and seems more readable. I wish that with either approach File.file? would work like this: Dir.entries(Pathname.getwd).each do |entry| if File.file?(entry) puts entry end end