I need a function or method in Python to find the owner of a file or directory.
The function should be like:
>>> find_owner(\"/home/somedir
See os.stat. It gives you st_uid which is the user ID of the owner. Then you have to convert it to the name. To do that, use pwd.getpwuid.
st_uid