#!/usr/bin/python
import os, sys
# Open a file
fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT )
# Now get the touple
info = os.fstat(fd)
print "File Info :", info
# Now get uid of the file
print "UID of the file :%d" % info.st_uid
# Now get gid of the file
print "GID of the file :%d" % info.st_gid
# Now get inode of the file
print "i-node number of the file :%d" % info.st_ino
# Now get size of the file
print "size of the file :%d" % info.st_size
# Now get number of blocks for the file
print "number of blocks allocated for file :%d" % info.st_blocks
# Close opened file
os.close( fd)
import os, sys
# Open a file
fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT )
# Now get the touple
info = os.fstat(fd)
print "File Info :", info
# Now get uid of the file
print "UID of the file :%d" % info.st_uid
# Now get gid of the file
print "GID of the file :%d" % info.st_gid
# Now get inode of the file
print "i-node number of the file :%d" % info.st_ino
# Now get size of the file
print "size of the file :%d" % info.st_size
# Now get number of blocks for the file
print "number of blocks allocated for file :%d" % info.st_blocks
# Close opened file
os.close( fd)
No comments:
Post a Comment