Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > inode number in windows XP

Reply
Thread Tools

inode number in windows XP

 
 
asit
Guest
Posts: n/a
 
      01-25-2008
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.
 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      01-25-2008
On Fri, 25 Jan 2008 04:28:43 -0800, asit wrote:

> why this program shows ambiguous behavior ??



You should read this page, it will help you solve your problem:

http://catb.org/~esr/faqs/smart-questions.html



--
Steven
 
Reply With Quote
 
 
 
 
Gabriel Genellina
Guest
Posts: n/a
 
      01-25-2008
On 25 ene, 10:28, asit <(E-Mail Removed)> wrote:

> 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.

--
Gabriel Genellina
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
access to file attributes via inode cartercc@gmail.com C Programming 4 01-31-2013 02:04 AM
open file by inode? ivowel@gmail.com Perl Misc 6 05-29-2006 08:28 AM
removing file by inode s99999999s2003@yahoo.com Python 5 03-23-2006 09:44 PM
freebsd (ufs) direct access to Hard drive using inode kerb C Programming 4 01-06-2005 09:22 AM
Linking to an opened inode w/o links left: how? Jan Stap C Programming 16 11-12-2003 07:11 PM



Advertisments