| |
- abspath(path)
- # Return an absolute path.
- basename(p)
- # Return the tail (basename) part of a path.
- commonprefix(m)
- # Return the longest prefix of all list elements.
- dirname(p)
- # Return the head (dirname) part of a path.
- exists(path)
- # Does a path exist?
- # This is false for dangling symbolic links.
- expanduser(path)
- # Expand paths beginning with '~' or '~user'.
- # '~' means $HOME; '~user' means that user's home directory.
- # If the path doesn't begin with '~', or if the user or $HOME is unknown,
- # the path is returned unchanged (leaving error reporting to whatever
- # function is called with the expanded path as argument).
- # See also module 'glob' for expansion of *, ? and [...] in pathnames.
- # (A function should also be defined to do full *sh-style environment
- # variable expansion.)
- expandvars(path)
- no doc string
- getatime(filename)
- Return the last access time of a file, reported by os.stat().
- getmtime(filename)
- Return the last modification time of a file, reported by os.stat().
- getsize(filename)
- Return the size of a file, reported by os.stat().
- isabs(s)
- # Return wheter a path is absolute.
- # Trivial in Posix, harder on the Mac or MS-DOS.
- # For DOS it is absolute if it starts with a slash or backslash (current
- # volume), or if a pathname after the volume letter and colon starts with
- # a slash or backslash.
- isdir(path)
- # Is a path a dos directory?
- # This follows symbolic links, so both islink() and isdir() can be true
- # for the same path.
- isfile(path)
- # Is a path a regular file?
- # This follows symbolic links, so both islink() and isdir() can be true
- # for the same path.
- islink(path)
- # Is a path a symbolic link?
- # This will always return false on systems where posix.lstat doesn't exist.
- ismount(path)
- # Is a path a mount point?
- # XXX This degenerates in: 'is this the root?' on DOS
- join(a, *p)
- # Join two (or more) paths.
- normcase(s)
- # Normalize the case of a pathname.
- # On MS-DOS it maps the pathname to lowercase, turns slashes into
- # backslashes.
- # Other normalizations (such as optimizing '../' away) are not allowed
- # (this is done by normpath).
- # Previously, this version mapped invalid consecutive characters to a
- # single '_', but this has been removed. This functionality should
- # possibly be added as a new function.
- normpath(path)
- # Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
- # Also, components of the path are silently truncated to 8+3 notation.
- split(p)
- # Split a path in head (everything up to the last '/') and tail (the
- # rest). After the trailing '/' is stripped, the invariant
- # join(head, tail) == p holds.
- # The resulting head won't end in '/' unless it is the root.
- splitdrive(p)
- # Split a path in a drive specification (a drive letter followed by a
- # colon) and the path specification.
- # It is always true that drivespec + pathspec == p
- splitext(p)
- # Split a path in root and extension.
- # The extension is everything starting at the first dot in the last
- # pathname component; the root is everything before that.
- # It is always true that root + ext == p.
- walk(top, func, arg)
- # Directory tree walk.
- # For each directory under top (including top itself, but excluding
- # '.' and '..'), func(arg, dirname, filenames) is called, where
- # dirname is the name of the directory and filenames is the list
- # files files (and subdirectories etc.) in the directory.
- # The func may modify the filenames list, to implement a filter,
- # or to impose a different order of visiting.
|