File owner attribute method


#1

I want to get the owner attribute of a file from a folder. I have not
found a class that contains a method like this. I have looked in File,
FileUtils and Ftools. Do you have a recommendation? Thanks. MC


#2

Mmcolli00 Mom removed_email_address@domain.invalid wrote:

I want to get the owner attribute of a file from a folder. I have not
found a class that contains a method like this. I have looked in File,
FileUtils and Ftools. Do you have a recommendation?

Not sure what an “owner attribute” is, but consider File#stat, perhaps.
File::Stat#uid might be what you’re looking for:

puts File.new(“somefile”).stat.uid #=> 501

Resolving 501 into a name is a different exercise.

m.


#3

What I mean is a file has attributes such as filename, size, modified
date, owner, author, etc… I thought that with File class having mtime,
that there must be a way to get other file attributes.