Added getsize(), getmtime(), getatime()
This commit is contained in:
parent
89a79d19b7
commit
2bc1f8f07e
|
@ -124,6 +124,24 @@ def commonprefix(m):
|
|||
return prefix
|
||||
|
||||
|
||||
# Get size, mtime, atime of files.
|
||||
|
||||
def getsize(filename):
|
||||
"""Return the size of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_SIZE]
|
||||
|
||||
def getmtime(filename):
|
||||
"""Return the last modification time of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
|
||||
def getatime(filename):
|
||||
"""Return the last access time of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
|
||||
|
||||
# Is a path a symbolic link?
|
||||
# This will always return false on systems where posix.lstat doesn't exist.
|
||||
|
||||
|
|
|
@ -99,6 +99,24 @@ def isdir(s):
|
|||
return S_ISDIR(st[ST_MODE])
|
||||
|
||||
|
||||
# Get size, mtime, atime of files.
|
||||
|
||||
def getsize(filename):
|
||||
"""Return the size of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_SIZE]
|
||||
|
||||
def getmtime(filename):
|
||||
"""Return the last modification time of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
|
||||
def getatime(filename):
|
||||
"""Return the last access time of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
|
||||
|
||||
# Return true if the pathname refers to a symbolic link.
|
||||
# (Always false on the Mac, until we understand Aliases.)
|
||||
|
||||
|
|
|
@ -143,6 +143,24 @@ def commonprefix(m):
|
|||
return prefix
|
||||
|
||||
|
||||
# Get size, mtime, atime of files.
|
||||
|
||||
def getsize(filename):
|
||||
"""Return the size of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_SIZE]
|
||||
|
||||
def getmtime(filename):
|
||||
"""Return the last modification time of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
|
||||
def getatime(filename):
|
||||
"""Return the last access time of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
|
||||
|
||||
# Is a path a symbolic link?
|
||||
# This will always return false on systems where posix.lstat doesn't exist.
|
||||
|
||||
|
|
|
@ -128,6 +128,24 @@ def commonprefix(m):
|
|||
return prefix
|
||||
|
||||
|
||||
# Get size, mtime, atime of files.
|
||||
|
||||
def getsize(filename):
|
||||
"""Return the size of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_SIZE]
|
||||
|
||||
def getmtime(filename):
|
||||
"""Return the last modification time of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
|
||||
def getatime(filename):
|
||||
"""Return the last access time of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
|
||||
|
||||
# Is a path a symbolic link?
|
||||
# This will always return false on systems where os.lstat doesn't exist.
|
||||
|
||||
|
|
Loading…
Reference in New Issue