Class holding informations on system files.
Class FileStat( [path] )
path | If given, the filestats will be initialized with stats of the given file. | ||
Raise |
|
The FileStat class holds informations on a single directory entry.
It is possible to pass a path parameter, in which case, if the given file is found, the contents of this class is filled with the stat data from the required file, otherwise an IoError is raised. The FileStat.read method would search for the required file without raising in case it is not found, so if it preferable not to raise on failure (i.e. because searching the most fitting of a list of possibly existing files), it is possiblo to create the FileStat object without parameters and the use the read method iteratively.
Both access and attribs properties are given a value respectively only on POSIX or MS-Windows systems; their value is the underlying numeric value the system provides. The ctime property has a different meaning in MS-Windows and POSIX system. In the former, is the time at which the file has been created; in the latter is the time when the file ownership flags have been last changed, which may or may not be the same as file creation time.
Times are returned as a TimeStamp class instance; the time is always expressed as local system time.
Properties | |
access | POSIX access mode |
atime | Last access time, expressed as a instance. |
attribs | DOS Attributes |
ctime | Creation time or last attribute change time, expressed as a instance. |
ftype | Type of the file. |
group | Group ID of the given file. |
mtime | Last modify time, expressed as a instance. |
owner | Owner ID of the given file. |
size | File size. |
Methods | |
read | Fills the data in this instance reading them from a system file. |
POSIX access mode
POSIX access mode
Last access time, expressed as a instance.
Last access time, expressed as a TimeStamp instance.
DOS Attributes
DOS Attributes
Creation time or last attribute change time, expressed as a instance.
Creation time or last attribute change time, expressed as a TimeStamp instance.
Type of the file.
Can be one of the following constants (declared in this class):
- NORMAL
Group ID of the given file.
Group ID of the given file.
Last modify time, expressed as a instance.
Last modify time, expressed as a TimeStamp instance.
Owner ID of the given file.
Owner ID of the given file.
File size.
File size.
Fills the data in this instance reading them from a system file.
FileStat.read( filename )
filename | Relative or absolute path to a file for which stats must be read |
Return | True on success, false if the file cannot be queried. |
Fills the contents of this object with informations on the given file. If the stats of the required file can be read, the function returns true.