[Tutor] Fwd: Permission Report

Stephen Nelson-Smith sanelson at gmail.com
Mon Oct 8 19:55:35 CEST 2007


Sorry...

---------- Forwarded message ----------
From: Stephen Nelson-Smith <sanelson at gmail.com>
Date: Oct 8, 2007 6:54 PM
Subject: Re: [Tutor] Permission Report
To: Alan Gauld <alan.gauld at btinternet.com>


On 10/8/07, Alan Gauld <alan.gauld at btinternet.com> wrote:

> Yes, os.walk and os.stat should do what you want.

Ok - I have:

import os, stat
permissions = {}

for dir, base, files in os.walk('/home/peter/third/accounts/'):
  for f in files:
    file = os.path.join(dir, f)
    perm = os.stat(file)[stat.ST_MODE]
    permissions[file] = oct(stat.S_IMODE(perm))

This is fine - it stores the info I need.

But if I want to run the same procedure on a remote host, and store
the results in a dictionary so they can be compared, what would I do?

S.


More information about the Tutor mailing list