inode number in windows XP

A

asit

why this program shows ambiguous behavior ??

import os
import stat
import time
#import types

file_name=raw_input("Enter file name : ")
print file_name, "information"
st=os.stat(file_name)
print "mode", "=>", oct(stat.S_IMODE(st[stat.ST_MODE]))

print "type","=>",
if stat.S_ISDIR(st[stat.ST_MODE]):
print "DIReCTORY"
elif stat.S_ISREG(st[stat.ST_MODE]):
print "REGULAR"
elif stat.S_ISLINK(st[stat.ST_MODE]):
print "LINK"

print "file size", "=>",st[stat.ST_SIZE]
print "inode number", "=>",st[stat.ST_INO]
print "device inode resides on", "=>",st[stat.ST_DEV]
print "number of links to this inode", "=>",st[stat.ST_NLINK]
print "last accessed", "=>", time.ctime(st[stat.ST_ATIME])
print "last modified", "=>", time.ctime(st[stat.ST_MTIME])
print "inode changed", "=>", time.ctime(st[stat.ST_CTIME])



i ran this program in Winows XP SP2 in python 2.5.
 
G

Gabriel Genellina

why this program shows ambiguous behavior ??

st=os.stat(file_name)
print "file size", "=>",st[stat.ST_SIZE]
print "inode number", "=>",st[stat.ST_INO]
print "device inode resides on", "=>",st[stat.ST_DEV]
print "number of links to this inode", "=>",st[stat.ST_NLINK]

i ran this program in Winows XP SP2 in python 2.5.

Using my recently repaired crystal ball, I see that you don't get what
you expect for some of those fields. All files sharing the same inode,
by example.
The usual file systems used by Windows aren't built around the inode
concept, they're different, so there is no "inode number" to report,
among other things. From http://docs.python.org/lib/os-file-dir.html
"On Windows, some items are filled with dummy values". Don't rely on
anything but st_mode, st_size, and st_[cma]time, and perhaps a few
more for fstat.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top