fork download
  1.  
  2. import os, sys
  3. from stat import *
  4.  
  5. sName = "test.txt"
  6.  
  7. if os.access( sName, os.F_OK ) == False :
  8. print "That file name doesn't exist!"
  9. exit()
  10.  
  11. sStat = os.stat( sName )
  12.  
  13. mMode= sStat[ST_MODE]
  14. if S_ISDIR(mMode) :
  15. print "The path is a directory"
  16. elif S_ISREG(mMode) :
  17. print "The path is a file"
  18. else :
  19. print "I have no idea what the path is"
  20.  
  21. userID = sStat[ST_UID]
  22. print str(userID)
  23.  
  24. fSize = sStat[ST_SIZE]
  25. print str(fSize)
  26.  
  27. accessTime = sStat[ST_ATIME]
  28. print str(accessTime)
  29. modTime = sStat[ST_MTIME]
  30. print str(modTime)
  31.  
  32.  
Success #stdin #stdout 0.03s 6356KB
stdin
Standard input is empty
stdout
That file name doesn't exist!