From: Robert Klemme Date: 2009-06-10T00:47:09+09:00 Subject: Re: Find out the name of a user, on a given file/dir/symlink? 2009/6/9 Marc Heiler : > Right now I use this: > > require 'fileutils' > require 'etc' > require 'pp' > > FileUtils.touch 'test' > > name = Etc.getpwuid(File.stat('test').uid).name > > puts name > > > This gives me the name of the file/dir/symlink in question, i.e > who owns it. > > However, I found this is a bit long. Anyone knows of a shorter > way? Specifically I wonder if I have to use both Etc. and File. > or if I can just one one of these two. As far as I can see you need both because File.stat only returns the numeric ID. irb(main):008:0> st = File.stat "." => # irb(main):009:0> st.owned? => true irb(main):010:0> st.uid => 14366 irb(main):011:0> Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/