Python find
Jeff Epler
jepler at unpythonic.net
Tue May 25 16:12:03 EDT 2004
On Tue, May 25, 2004 at 12:36:51PM -0400, George Sakkis wrote:
> - How can one get the filesystem name from python (e.g. for testing
> 'find -fstype nfs') ?
You need to call "statfs" which I don't believe is available in Python
without an extension module.
I only know of the incomplete list of magic numbers to filesystem types
listed in "man statfs", not a real way to find the filesystem name.
Another option would getmntent() or (linux only) parsing /proc/mounts
parser.
> - Does os.readlink perform a call to os.stat or os.lstat (or the equivalent
> C system calls) ? If yes, I would like to rewrite it for the case the stat
> info for a file has already been cached.
No, at least on my system it uses the readlink syscall. I don't see the
readlink information contained anywhere in the stat/lstat structure.
> - Before I write it from scratch, is there a converter for Unix permission
> strings (like "+go=rw") to numeric modes ?
Not that I recall seeing...
Jeff
More information about the Python-list
mailing list