I am a path on the filesystem that only permits 'downwards'
access.
Instantiate me with a pathname (for example,
FilePath('/home/myuser/public_html')) and I will attempt to only provide
access to files which reside inside that path. I may be a path to a
file, a directory, or a file which does not exist.
The correct way to use me is to instantiate me, and then do ALL
filesystem access through me. In other words, do not import the 'os'
module; if you need to open a file, call my 'open' method. If you need
to list a directory, call my 'path' method.
Even if you pass me a relative path, I will convert that to an
absolute path internally.
Note: although time-related methods do return floating-point results,
they may still be only second resolution depending on the platform and
the last value passed to os.stat_float_times
.
If you want greater-than-second precision, call
os.stat_float_times(True)
, or use Python 2.5.
Greater-than-second precision is only available in Windows on Python2.5
and later.
|
|
|
|
|
__init__(self,
path,
alwaysCreate=False) |
|
|
|
|
|
|
|
|
|
|
|
chmod(self,
mode)
Changes the permissions on self, if possible. |
|
|
|
copyTo(self,
destination) |
|
|
|
create(self)
Exclusively create a file, only if this file previously did not
exist. |
|
|
|
|
|
|
bool
|
exists(self)
Check if the path exists. |
|
|
float
|
getAccessTime(self)
Retrieve the time that this file was last accessed. |
|
|
float
|
|
float
|
|
|
|
|
globChildren(self,
pattern)
Assuming I am representing a directory, return a list of FilePaths
representing my children that match the given pattern. |
|
|
|
|
|
|
|
|
|
|
|
linkTo(self,
linkFilePath)
Creates a symlink to self to at the path in the FilePath linkFilePath . |
|
|
|
|
|
makedirs(self)
Create all directories not yet existing in path
segments, using os.makedirs . |
|
|
|
moveTo(self,
destination) |
|
|
|
|
|
|
|
preauthChild(self,
path)
Use me if `path' might have slashes in it, but you know they're safe. |
|
|
|
remove(self)
Removes the file or directory that is represented by self. |
|
|
|
requireCreate(self,
val=1) |
|
|
|
restat(self,
reraise=True)
Re-calculate cached effects of 'stat'. |
|
|
|
setContent(self,
content,
ext=' .new ' ) |
|
|
|
siblingExtension(self,
ext) |
|
|
|
siblingExtensionSearch(self,
*exts)
Attempt to return a path with my name, given multiple possible
extensions. |
|
|
|
|
|
temporarySibling(self)
Create a path naming a temporary sibling of this path in a secure
fashion. |
|
|
|
|
Inherited from _PathHelper :
__hash__ ,
children ,
getContent ,
getatime ,
getctime ,
getmtime ,
segmentsFrom ,
sibling ,
walk
|