Obtaining the attributes and properties of a folder recursively.

Tim Golden mail at timgolden.me.uk
Fri Mar 20 14:58:00 CET 2009

venutaurus539 at gmail.com wrote:
> Thank you for your suggestion but.. I'll have around 1000 such files
> in the whole directory and it becomes hard to manage such output
> because again I've to take this snapshot before backing up the data
> and have to do the same and compare both when the data gets restored,
> just to verify whether the restore happened successfully or not.

The .dump is simply a way of seeing quickly what the data is.
If you want to store is somewhere (.csv or whatever), you can
just select the attributes you want. Note, though, that ACLs
are tricky to compare. Something like the following might do
what you want, perhaps?

import os
import csv
from winsys import fs

with open ("info.csv", "wb") as f:
  writer = csv.writer (f)
  for f in fs.flat ("c:/temp/cabsdk"):
    print f
    writer.writerow ([
      f.security (),
os.startfile ("info.csv")

This uses the security's SDDL representation, which while
opaque does at least give you a before-and-after check.


More information about the Python-list mailing list