How to find the full path of a file in a present in a direct

Hi,

I need to know how to determine the full path of o file which is present
in a directory.

File.expand_path(item) if File.exist?(item) && File.file?(item)

dima wrote:

File.expand_path(item) if File.exist?(item) && File.file?(item)

Thank you very much, but this is only for one file I supposeā€¦I want
to determine the full path of multiple files which are present in a
particular directory.

And " item " in the above code is the file name I suppose.

items_full_path = []
Dir.new(".").entries.each do |item|
items_full_path << File.expand_path(item) if File.exist?(item) &&
File.file?(item)
end

On Aug 24, 12:12 pm, Advait B. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs