/ ITC Help System
/ Site map
/ NM Tech homepage
pathinfo.py: A Python file info object
The PathInfo object, defined in the
pathinfo.py source file,
represents status information for a file or directory.
It is basically just some sugarcoating around the standard
Python library functions from the os module.
Its built-in .__str__() method displays the file's
information on a line with this format,
drwxrwxrwx yyyy-mm-dd hh:mm:ss p
that is, the permissions (as in the Unix ls command),
the modification timestamp, and the pathname.
Exported methods in the PathInfo object are listed
below. Methods described as ``predicates'' return a nonzero
integer for true, zero for false.
- PathInfo(pathname): Returns a new object
representing the status of the pathname, if any. If there
is no such pathname, an exception is raised.
- .size(): Returns the file's size in bytes.
- .ownerCanRead(): Predicate for testing whether
the owner can read the path, that is, it returns true if and
only if the owner has read permission.
- .ownerCanWrite(): Predicate for testing whether
the owner has write permission.
- .ownerCanExec(): Predicate for testing owner's
- .groupCanRead(): Predicate for testing group read permission.
- .groupCanWrite(): Predicate for testing group write permission.
- .groupCanExec(): Predicate for testing group execute
- .worldCanRead(): Predicate for testing world read permission.
- .worldCanWrite(): Predicate for testing world write permission.
- .worldCanExec(): Predicate for testing world execute
- .isDir(): Predicate for testing whether a path is a
- .isFile(): Predicate for testing whether a path is an
- .isLink(): Predicate for testing whether a path is a soft
See also: Systems programming in Python
Previous: oldfiles: Where are my oldest files?
to help pages
New Mexico Tech Information Technology and Communications: Help System
To report a problem: File a ticket
Send mail to the User consultant
on duty or call them at 575-835-5437
About New Mexico Tech
John Shipman, firstname.lastname@example.org
Last updated: 2004/03/07 01:47:13 UT