Chris Johnson wrote: > > > > I am trying to print the attributes of a file. > > > > The want I am most interested in is the owner. This is on windows xp. > > > > Any help would be appreciated. >
import win32security o = win32security.GetFileSecurity( filename, win32security.OWNER_SECURITY_INFORMATION ) s = o.GetSecurityDescriptorOwner() # This prints the SID form: print str(s) # PySID:S-1-5-21-1709892333-1682012616-2269307891-1141 # This gets the human-readable form: s2 = sec.LookupAccountSid( '.', s ) print s2 # (u'timr', u'PROBO', 1) That says this file is owned by user "timr" in domain "PROBO". The "1" means this is a user, not a group (win32security.SidTypeUser). -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-win32
