Forum: Ruby File owner attribute method

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cf63da956b6ba955687a2f2f262928cb?d=identicon&s=25 Mmcolli00 Mom (mmcolli00)
on 2009-03-13 21:57
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
Fbb4d027695dfdf76bf448b15d7e306a?d=identicon&s=25 matt neuburg (Guest)
on 2009-03-13 23:55
(Received via mailing list)
Mmcolli00 Mom <mmc_collins@yahoo.com> 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.
Cf63da956b6ba955687a2f2f262928cb?d=identicon&s=25 Mmcolli00 Mom (mmcolli00)
on 2009-03-14 02:52
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.
This topic is locked and can not be replied to.