stat
import stat
The module provides constants and functions for interpreting results of file.stat().
The stat API
Every public name in stat, wherever it is declared. Each links to the
page that documents it.
| Name | Kind | Summary |
|---|---|---|
stat.FILE_ATTRIBUTE_ARCHIVE | constant | |
stat.FILE_ATTRIBUTE_COMPRESSED | constant | |
stat.FILE_ATTRIBUTE_DEVICE | constant | |
stat.FILE_ATTRIBUTE_DIRECTORY | constant | |
stat.FILE_ATTRIBUTE_ENCRYPTED | constant | |
stat.FILE_ATTRIBUTE_HIDDEN | constant | |
stat.FILE_ATTRIBUTE_INTEGRITY_STREAM | constant | |
stat.FILE_ATTRIBUTE_NORMAL | constant | |
stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | constant | |
stat.FILE_ATTRIBUTE_NO_SCRUB_DATA | constant | |
stat.FILE_ATTRIBUTE_OFFLINE | constant | |
stat.FILE_ATTRIBUTE_READONLY | constant | |
stat.FILE_ATTRIBUTE_REPARSE_POINT | constant | |
stat.FILE_ATTRIBUTE_SPARSE_FILE | constant | |
stat.FILE_ATTRIBUTE_SYSTEM | constant | |
stat.FILE_ATTRIBUTE_TEMPORARY | constant | |
stat.FILE_ATTRIBUTE_VIRTUAL | constant | |
stat.SF_APPEND | constant | |
stat.SF_ARCHIVED | constant | |
stat.SF_IMMUTABLE | constant | |
stat.SF_NOUNLINK | constant | |
stat.SF_SNAPSHOT | constant | |
stat.ST_ATIME | constant | |
stat.ST_CTIME | constant | |
stat.ST_DEV | constant | |
stat.ST_GID | constant | |
stat.ST_INO | constant | |
stat.ST_MODE | constant | |
stat.ST_MTIME | constant | |
stat.ST_NLINK | constant | |
stat.ST_SIZE | constant | |
stat.ST_UID | constant | |
stat.S_ENFMT | constant | |
stat.S_IEXEC | constant | |
stat.S_IFBLK | constant | |
stat.S_IFCHR | constant | |
stat.S_IFDIR | constant | |
stat.S_IFDOOR | constant | |
stat.S_IFIFO | constant | |
stat.S_IFLNK | constant | |
stat.S_IFMT | function | Return the portion of the file’s mode that describes the file type. |
stat.S_IFPORT | constant | |
stat.S_IFREG | constant | |
stat.S_IFSOCK | constant | |
stat.S_IFWHT | constant | |
stat.S_IMODE | function | Return the portion of the file’s mode that can be set by file.chmod(). |
stat.S_IREAD | constant | |
stat.S_IRGRP | constant | |
stat.S_IROTH | constant | |
stat.S_IRUSR | constant | |
stat.S_IRWXG | constant | |
stat.S_IRWXO | constant | |
stat.S_IRWXU | constant | |
stat.S_ISBLK | function | Return true if mode is from a block special device file. |
stat.S_ISCHR | function | Return true if mode is from a character special device file. |
stat.S_ISDIR | function | Return true if mode is from a directory. |
stat.S_ISDOOR | function | Return true if mode is from a door. |
stat.S_ISFIFO | function | Return true if mode is from a FIFO (named pipe). |
stat.S_ISGID | constant | |
stat.S_ISLNK | function | Return true if mode is from a symbolic link. |
stat.S_ISPORT | function | Return true if mode is from an event port. |
stat.S_ISREG | function | Return true if mode is from a regular file. |
stat.S_ISSOCK | function | Return true if mode is from a socket. |
stat.S_ISUID | constant | |
stat.S_ISVTX | constant | |
stat.S_ISWHT | function | Return true if mode is from a whiteout. |
stat.S_IWGRP | constant | |
stat.S_IWOTH | constant | |
stat.S_IWRITE | constant | |
stat.S_IWUSR | constant | |
stat.S_IXGRP | constant | |
stat.S_IXOTH | constant | |
stat.S_IXUSR | constant | |
stat.UF_APPEND | constant | |
stat.UF_COMPRESSED | constant | |
stat.UF_HIDDEN | constant | |
stat.UF_IMMUTABLE | constant | |
stat.UF_NODUMP | constant | |
stat.UF_NOUNLINK | constant | |
stat.UF_OPAQUE | constant | |
stat.file_mode | function | Convert a file’s mode to a string of the form ‘-rwxrwxrwx’. |
Constants
ST_MODE
stat.ST_MODE = 0
ST_INO
stat.ST_INO = 1
ST_DEV
stat.ST_DEV = 2
ST_NLINK
stat.ST_NLINK = 3
ST_UID
stat.ST_UID = 4
ST_GID
stat.ST_GID = 5
ST_SIZE
stat.ST_SIZE = 6
ST_ATIME
stat.ST_ATIME = 7
ST_MTIME
stat.ST_MTIME = 8
ST_CTIME
stat.ST_CTIME = 9
S_IFDIR
stat.S_IFDIR = 16384
S_IFCHR
stat.S_IFCHR = 8192
S_IFBLK
stat.S_IFBLK = 24576
S_IFREG
stat.S_IFREG = 32768
S_IFIFO
stat.S_IFIFO = 4096
S_IFLNK
stat.S_IFLNK = 40960
S_IFSOCK
stat.S_IFSOCK = 49152
S_IFDOOR
stat.S_IFDOOR = 0
S_IFPORT
stat.S_IFPORT = 0
S_IFWHT
stat.S_IFWHT = 0
S_ISUID
stat.S_ISUID = 2048
S_ISGID
stat.S_ISGID = 1024
S_ENFMT
stat.S_ENFMT
S_ISVTX
stat.S_ISVTX = 512
S_IREAD
stat.S_IREAD = 256
S_IWRITE
stat.S_IWRITE = 128
S_IEXEC
stat.S_IEXEC = 64
S_IRWXU
stat.S_IRWXU = 448
S_IRUSR
stat.S_IRUSR = 256
S_IWUSR
stat.S_IWUSR = 128
S_IXUSR
stat.S_IXUSR = 64
S_IRWXG
stat.S_IRWXG = 56
S_IRGRP
stat.S_IRGRP = 32
S_IWGRP
stat.S_IWGRP = 16
S_IXGRP
stat.S_IXGRP = 8
S_IRWXO
stat.S_IRWXO = 7
S_IROTH
stat.S_IROTH = 4
S_IWOTH
stat.S_IWOTH = 2
S_IXOTH
stat.S_IXOTH = 1
UF_NODUMP
stat.UF_NODUMP = 1
UF_IMMUTABLE
stat.UF_IMMUTABLE = 2
UF_APPEND
stat.UF_APPEND = 4
UF_OPAQUE
stat.UF_OPAQUE = 8
UF_NOUNLINK
stat.UF_NOUNLINK = 16
UF_COMPRESSED
stat.UF_COMPRESSED = 32
UF_HIDDEN
stat.UF_HIDDEN = 32768
SF_ARCHIVED
stat.SF_ARCHIVED = 65536
SF_IMMUTABLE
stat.SF_IMMUTABLE = 131072
SF_APPEND
stat.SF_APPEND = 262144
SF_NOUNLINK
stat.SF_NOUNLINK = 1048576
SF_SNAPSHOT
stat.SF_SNAPSHOT = 2097152
FILE_ATTRIBUTE_ARCHIVE
stat.FILE_ATTRIBUTE_ARCHIVE = 32
FILE_ATTRIBUTE_COMPRESSED
stat.FILE_ATTRIBUTE_COMPRESSED = 2048
FILE_ATTRIBUTE_DEVICE
stat.FILE_ATTRIBUTE_DEVICE = 64
FILE_ATTRIBUTE_DIRECTORY
stat.FILE_ATTRIBUTE_DIRECTORY = 16
FILE_ATTRIBUTE_ENCRYPTED
stat.FILE_ATTRIBUTE_ENCRYPTED = 16384
FILE_ATTRIBUTE_HIDDEN
stat.FILE_ATTRIBUTE_HIDDEN = 2
FILE_ATTRIBUTE_INTEGRITY_STREAM
stat.FILE_ATTRIBUTE_INTEGRITY_STREAM = 32768
FILE_ATTRIBUTE_NORMAL
stat.FILE_ATTRIBUTE_NORMAL = 128
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 8192
FILE_ATTRIBUTE_NO_SCRUB_DATA
stat.FILE_ATTRIBUTE_NO_SCRUB_DATA = 131072
FILE_ATTRIBUTE_OFFLINE
stat.FILE_ATTRIBUTE_OFFLINE = 4096
FILE_ATTRIBUTE_READONLY
stat.FILE_ATTRIBUTE_READONLY = 1
FILE_ATTRIBUTE_REPARSE_POINT
stat.FILE_ATTRIBUTE_REPARSE_POINT = 1024
FILE_ATTRIBUTE_SPARSE_FILE
stat.FILE_ATTRIBUTE_SPARSE_FILE = 512
FILE_ATTRIBUTE_SYSTEM
stat.FILE_ATTRIBUTE_SYSTEM = 4
FILE_ATTRIBUTE_TEMPORARY
stat.FILE_ATTRIBUTE_TEMPORARY = 256
FILE_ATTRIBUTE_VIRTUAL
stat.FILE_ATTRIBUTE_VIRTUAL = 65536
Functions
S_IMODE()
stat.S_IMODE(mode: number) -> number
Return the portion of the file’s mode that can be set by file.chmod().
Parameters
mode(number)
Returns number
S_IFMT()
stat.S_IFMT(mode: number) -> number
Return the portion of the file’s mode that describes the file type.
Parameters
mode(number)
Returns number
S_ISDIR()
stat.S_ISDIR(mode: number) -> number
Return true if mode is from a directory.
Parameters
mode(number)
Returns number
S_ISCHR()
stat.S_ISCHR(mode: number) -> number
Return true if mode is from a character special device file.
Parameters
mode(number)
Returns number
S_ISBLK()
stat.S_ISBLK(mode: number) -> number
Return true if mode is from a block special device file.
Parameters
mode(number)
Returns number
S_ISREG()
stat.S_ISREG(mode: number) -> number
Return true if mode is from a regular file.
Parameters
mode(number)
Returns number
S_ISFIFO()
stat.S_ISFIFO(mode: number) -> number
Return true if mode is from a FIFO (named pipe).
Parameters
mode(number)
Returns number
S_ISLNK()
stat.S_ISLNK(mode: number) -> number
Return true if mode is from a symbolic link.
Parameters
mode(number)
Returns number
S_ISSOCK()
stat.S_ISSOCK(mode: number) -> number
Return true if mode is from a socket.
Parameters
mode(number)
Returns number
S_ISDOOR()
stat.S_ISDOOR(mode: number) -> number
Return true if mode is from a door.
Parameters
mode(number)
Returns number
S_ISPORT()
stat.S_ISPORT(mode: number) -> number
Return true if mode is from an event port.
Parameters
mode(number)
Returns number
S_ISWHT()
stat.S_ISWHT(mode: number) -> number
Return true if mode is from a whiteout.
Parameters
mode(number)
Returns number
file_mode()
stat.file_mode(mode: number) -> string
Convert a file’s mode to a string of the form ‘-rwxrwxrwx’.
Parameters
mode(number)
Returns string
2022, Richard Ore and The Zuri Contributors