473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

inode number in windows XP

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.
Jan 25 '08 #1
2 6186
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
Jan 25 '08 #2
On 25 ene, 10:28, asit <lipu...@gmail.comwrote:
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
Jan 25 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: tom | last post by:
Hi, How do I get the serial number of the harddisk in .NET? I want this to be the same number even if the user has reformatted, so I do not want the volume serial number. Thanx, t
79
by: Klaus Bonadt | last post by:
In order to protect software from being copied without licence, I would like to use something like a key, which fits only to the current system. The serial number of the CPU or the current...
16
by: Jan Stap | last post by:
Hi, I am writing a wrapper in C for an existing program. The wrapper maintains a run file that is created for one invocation of the program and is removed for another. My idea of making the last...
4
by: kerb | last post by:
Hello can you help I am trying to access direct address in ufs filesystem what I am trying to do is for example I have inode 12930123912 and I want to know where on which CHS (cylinder,head...
5
by: s99999999s2003 | last post by:
hi this is pertain to unix environment. is it possible to remove a file by it's inode and not it's filename using Python? Just curious... thanks.
9
by: Alex | last post by:
Get the Name and Phone Number of the Current Windows User in a .NET Application I am writing a simple .NET (C#) application. It needs to "automatic" get the Name (last, first) and phone number...
2
ashitpro
by: ashitpro | last post by:
I am working in kernel space. I want to read the file with it's inode number. I have two things with me. 1. inode number of file 2. device or partition(hda1,hda2 etc) I want to read the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.