[python-win32] overview of ntfs permissions ?

Tim Golden mail at timgolden.me.uk
Wed May 27 10:13:31 CEST 2009

Stef Mientki wrote:
> hello,
> is there a way to get an overview of ntfs permissions,
> of a specified part of a directory tree ?

(I've recently answered amost this question over on
StockOverflow as it happens: it wasn't you, was it? :) )

One answer is to use cacls / xcacls, the command-line
tool which ships with Windows.

If you want a Python-y way of doing it (which is,
I assume, why you asked here) then I can do no better
than recommend my fledgling winsys module:

MSI here:

or Subversion here:
  svn co http://winsys.googlecode.com/svn/trunk winsys

The code would then be something like (depending on what you
actually wanted to show...):

from winsys import fs

ROOT = "c:/temp"
# For purposes of illustration, just show directories
for directory, dirs, files in fs.walk (ROOT):
  dirpath = directory.filepath.relative_to (ROOT)
  indent = "  " * dirpath.count (fs.sep)
  print indent, dirpath
  security = directory.security ()
  for dace in directory.security ().dacl:
    print indent, dace


Obviously, it depends on exactly what you're after. If you'd
rather do it with "native" Python+pywin32, I'm happy to produce
an example, but it's a bit tedious (which is why I wrote the
winsys package to save myself the trouble of remembering...)


More information about the python-win32 mailing list