GNU Info

Info Node: (python2.1-lib.info)Files and Directories

(python2.1-lib.info)Files and Directories


Next: Process Management Prev: File Descriptor Operations Up: os
Enter node , (file) or (file)node

Files and Directories
---------------------

`access(path, mode)'
     Check read/write/execute permissions for this process or existence
     of file PATH.  MODE should be `F_OK' to test the existence of
     PATH, or it can be the inclusive OR of one or more of `R_OK',
     `W_OK', and `X_OK' to test permissions.  Return `1' if access is
     allowed, `0' if not.  See the UNIX man page `access(2)' for more
     information.  Availability: UNIX, Windows.

`F_OK'
     Value to pass as the MODE parameter of `access()' to test the
     existence of PATH.

`R_OK'
     Value to include in the MODE parameter of `access()' to test the
     readability of PATH.

`W_OK'
     Value to include in the MODE parameter of `access()' to test the
     writability of PATH.

`X_OK'
     Value to include in the MODE parameter of `access()' to determine
     if PATH can be executed.

`chdir(path)'
     Change the current working directory to PATH.  Availability:
     Macintosh, UNIX, Windows.

`getcwd()'
     Return a string representing the current working directory.
     Availability: Macintosh, UNIX, Windows.

`chmod(path, mode)'
     Change the mode of PATH to the numeric MODE.  Availability: UNIX,
     Windows.

`chown(path, uid, gid)'
     Change the owner and group id of PATH to the numeric UID and GID.
     Availability: UNIX.

`link(src, dst)'
     Create a hard link pointing to SRC named DST.  Availability: UNIX.

`listdir(path)'
     Return a list containing the names of the entries in the directory.
     The list is in arbitrary order.  It does not include the special
     entries `'.'' and `'..'' even if they are present in the directory.
     Availability: Macintosh, UNIX, Windows.

`lstat(path)'
     Like `stat()', but do not follow symbolic links.  Availability:
     UNIX.

`mkfifo(path[, mode])'
     Create a FIFO (a named pipe) named PATH with numeric mode MODE.
     The default MODE is `0666' (octal).  The current umask value is
     first masked out from the mode.  Availability: UNIX.

     FIFOs are pipes that can be accessed like regular files.  FIFOs
     exist until they are deleted (for example with `os.unlink()').
     Generally, FIFOs are used as rendezvous between "client" and
     "server" type processes: the server opens the FIFO for reading, and
     the client opens it for writing.  Note that `mkfifo()' doesn't
     open the FIFO -- it just creates the rendezvous point.

`mkdir(path[, mode])'
     Create a directory named PATH with numeric mode MODE.  The default
     MODE is `0777' (octal).  On some systems, MODE is ignored.  Where
     it is used, the current umask value is first masked out.
     Availability: Macintosh, UNIX, Windows.

`makedirs(path[, mode])'
     Recursive directory creation function.  Like `mkdir()', but makes
     all intermediate-level directories needed to contain the leaf
     directory.  Throws an `error' exception if the leaf directory
     already exists or cannot be created.  The default MODE is `0777'
     (octal).  _Added in Python version 1.5.2_

`pathconf(path, name)'
     Return system configuration information relevant to a named file.
     NAME specifies the configuration value to retrieve; it may be a
     string which is the name of a defined system value; these names are
     specified in a number of standards (POSIX.1, Unix95, Unix98, and
     others).  Some platforms define additional names as well.  The
     names known to the host operating system are given in the
     `pathconf_names' dictionary.  For configuration variables not
     included in that mapping, passing an integer for NAME is also
     accepted.  Availability: UNIX.

     If NAME is a string and is not known, `ValueError' is raised.  If
     a specific value for NAME is not supported by the host system,
     even if it is included in `pathconf_names', an `OSError' is raised
     with `errno.EINVAL' for the error number.

`pathconf_names'
     Dictionary mapping names accepted by `pathconf()' and
     `fpathconf()' to the integer values defined for those names by the
     host operating system.  This can be used to determine the set of
     names known to the system.  Availability: UNIX.

`readlink(path)'
     Return a string representing the path to which the symbolic link
     points.  The result may be either an absolute or relative
     pathname; if it is relative, it may be converted to an absolute
     pathname using `os.path.join(os.path.dirname(PATH), RESULT)'.
     Availability: UNIX.

`remove(path)'
     Remove the file PATH.  If PATH is a directory, `OSError' is
     raised; see `rmdir()' below to remove a directory.  This is
     identical to the `unlink()' function documented below.  On
     Windows, attempting to remove a file that is in use causes an
     exception to be raised; on UNIX, the directory entry is removed
     but the storage allocated to the file is not made available until
     the original file is no longer in use.  Availability: Macintosh,
     UNIX, Windows.

`removedirs(path)'
     Recursive directory removal function.  Works like `rmdir()' except
     that, if the leaf directory is successfully removed, directories
     corresponding to rightmost path segments will be pruned way until
     either the whole path is consumed or an error is raised (which is
     ignored, because it generally means that a parent directory is not
     empty).  Throws an `error' exception if the leaf directory could
     not be successfully removed.  _Added in Python version 1.5.2_

`rename(src, dst)'
     Rename the file or directory SRC to DST.  If DST is a directory,
     `OSError' will be raised.  On UNIX, if DST exists and is a file,
     it will be removed silently if the user has permission.  The
     operation may fail on some UNIX flavors if SRC and DST are on
     different filesystems.  If successful, the renaming will be an
     atomic operation (this is a POSIX requirement).  On Windows, if
     DST already exists, `OSError' will be raised even if it is a file;
     there may be no way to implement an atomic rename when DST names
     an existing file.  Availability: Macintosh, UNIX, Windows.

`renames(old, new)'
     Recursive directory or file renaming function.  Works like
     `rename()', except creation of any intermediate directories needed
     to make the new pathname good is attempted first.  After the
     rename, directories corresponding to rightmost path segments of
     the old name will be pruned away using `removedirs()'.

     Note: this function can fail with the new directory structure made
     if you lack permissions needed to remove the leaf directory or
     file.  _Added in Python version 1.5.2_

`rmdir(path)'
     Remove the directory PATH.  Availability: Macintosh, UNIX, Windows.

`stat(path)'
     Perform a `stat()' system call on the given path.  The return
     value is a tuple of at least 10 integers giving the most important
     (and portable) members of the _stat_ structure, in the order
     `st_mode', `st_ino', `st_dev', `st_nlink', `st_uid', `st_gid',
     `st_size', `st_atime', `st_mtime', `st_ctime'.  More items may be
     added at the end by some implementations.  Note that on the
     Macintosh, the time values are floating point values, like all
     time values on the Macintosh.  (On MS Windows, some items are
     filled with dummy values.)  Availability: Macintosh, UNIX, Windows.

     Note: The standard module `stat'  defines functions and constants
     that are useful for extracting information from a `stat' structure.

`statvfs(path)'
     Perform a `statvfs()' system call on the given path.  The return
     value is a tuple of 10 integers giving the most common members of
     the `statvfs' structure, in the order `f_bsize', `f_frsize',
     `f_blocks', `f_bfree', `f_bavail', `f_files', `f_ffree',
     `f_favail', `f_flag', `f_namemax'.  Availability: UNIX.

     Note: The standard module `statvfs' defines constants that are
     useful for extracting information from a `statvfs' structure.

`symlink(src, dst)'
     Create a symbolic link pointing to SRC named DST.  Availability:
     UNIX.

`tempnam([dir[, prefix]])'
     Return a unique path name that is reasonable for creating a
     temporary file.  This will be an absolute path that names a
     potential directory entry in the directory DIR or a common
     location for temporary files if DIR is omitted or `None'.  If
     given and not `None', PREFIX is used to provide a short prefix to
     the filename.  Applications are responsible for properly creating
     and managing files created using paths returned by `tempnam()'; no
     automatic cleanup is provided.  Availability: UNIX.

`tmpnam()'
     Return a unique path name that is reasonable for creating a
     temporary file.  This will be an absolute path that names a
     potential directory entry in a common location for temporary
     files.  Applications are responsible for properly creating and
     managing files created using paths returned by `tmpnam()'; no
     automatic cleanup is provided.  Availability: UNIX.

`TMP_MAX'
     The maximum number of unique names that `tmpnam()' will generate
     before reusing names.  Availability: UNIX, Windows.

`unlink(path)'
     Remove the file PATH.  This is the same function as `remove()';
     the `unlink()' name is its traditional UNIX name.  Availability:
     Macintosh, UNIX, Windows.

`utime(path, times)'
     Set the access and modified times of the file specified by PATH.
     If TIMES is `None', then the file's access and modified times are
     set to the current time.  Otherwise, TIMES must be a 2-tuple of
     numbers, of the form `(ATIME, MTIME)' which is used to set the
     access and modified times, respectively.  _Changed in Python
     version 2.0_ Availability: Macintosh, UNIX, Windows.


automatically generated by info2www version 1.2.2.9