From: ChrisH Date: 2006-03-23T04:53:52+09:00 Subject: Re: Find.find and files in cwd rtilley wrote: > I can use Find.find(Pathname.getwd) to get an array of all file paths > recursively, but how do I get only the files in the cwd (do not recurse > into sub-directories)? > > Thank you, > Brad Was just reviewing the docs for Find (http://ruby-doc.org/stdlib/libdoc/find/rdoc/classes/Find.html) and they have a nice example of how to use it. For your case you could say: require 'find' require 'pathname' require 'pp' root = Pathname.getwd pp "Looking in #{root}" Find.find(root) do |path| next if path == root #look in the given directory if FileTest.directory?(path) Find.prune # but don't look into sub-dir(s). else pp path end end cheers