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.

I didn't find a quick way to just retrieve the name in class File
though.
-- 
Posted via http://www.ruby-forum.com/.