"/" dir backup
Sat, 16 Feb 2002 19:31:45 -0800
Ben Escoto wrote:
> Well, at least one reason is that I don't know what st_rdev is...
oh. Thats a pretty good reason. <g>
>>> s = os.lstat('/dev/null')
>>> s.st_rdev >> 8
>>> s.st_rdev & 0xff
stink-foot<~/>ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Jan 5 19:07 /dev/null
> Hmm, good point. I suppose I could start parsing stat's output
> starting from the end...
yeah that would be safer, though given that on linux w/python 2.2
st_rdev tells you what you want to know already without an external
program I'm not sure its worth the effort. I don't know what other
platforms report st_rdev, but I suspect its more than a compliant
stat(1) will be found on.
The only downside is that the technique used to determine the major
and minor device numbers could be different from platform to platform,
but thats probably easier to code for than wildly different stat(1)
Jamie Heilman http://audible.transient.net/~jamie/
"Paranoia is a disease unto itself, and may I add, the person standing
next to you may not be who they appear to be, so take precaution."