How do I access a file's ( exe or dlls) owner details using perl?
I wanted to simply print out these details for a directory, and I wanted to write the script in perl, any i开发者_如何转开发nsights?
Use stat
to get the UID of the file's owner and getpwuid
to get the username for the ID, e.g.:
my $owner = getpwuid((stat)[4]);
Note that, if you call getpwuid
in list context, it will return a list of values, the first of which is the username.
精彩评论