Windows: get owner and group of a file

MRAB google at mrabarnett.plus.com
Thu Dec 7 18:31:24 EST 2006


kai rosenthal wrote:
> Hello,
>
> with ls -l on windows I get
> -rw-r--r-- 1 500 everyone 320 Nov 09 09:35 myfile
>
> How can I get on windows with a standard python 2.2 (without windows
> extensions) the information "500" and "everyone" (owner and group)?
> Also I cannot use popen('ls -l').
>
> With
> import stat
> stat_info = os.lstat(myfile)
> owner = "%-8s" % stat_info.st_uid
> group = "%-8s" % stat_info.st_gid
> I get 0 for owner and group.
>
> Thanks for your hints, Kai
>
If you can't use os.popen('ls -l'), can you instead use os.system('ls
-l >C:\\Temp\\result.txt') and then parse result.txt?




More information about the Python-list mailing list