Brad Tilley
3/21/2006 8:15:00 PM
James Edward Gray II wrote:
> On Mar 21, 2006, at 1:18 PM, 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)?
>
>
> Try:
>
> Dir["#{Dir.getwd}/*"]
Yes, that helps... thank you. Perhaps I'm using it wrong though. When
trying to extract files with File.file? or links with File.link? like this:
Dir["#{Dir.getwd}/*"].each do |path|
if File.file?(path)
puts path
end
end
I get the whole directory listing (files, links, folders, etc.)