os.Path methods

Table 1. Class methods
Name Description
os.Path.separator()
  RETURNING result STRING
Returns the character used to separate path segments.
os.Path.pathseparator()
  RETURNING result STRING
Returns the character used in environment variables to separate path elements.
os.Path.basename(
   filename STRING)
  RETURNING result STRING
Returns the last element of a path.
os.Path.dirname(
   filename STRING)
  RETURNING result STRING
Returns all components of a path excluding the last one.
os.Path.rootname(
   filename STRING)
  RETURNING result STRING
Returns the file path without the file extension of the last element of the file path.
os.Path.join(
   begin STRING,
   end STRING )
  RETURNING result STRING
Joins two path segments adding the platform-dependent separator.
os.Path.pathtype(
   path STRING)
  RETURNING result STRING
Checks if a path is a relative path or an absolute path.
os.Path.fullpath(
   path STRING)
  RETURNING result STRING
Returns the canonical equivalent of a path.
os.Path.exists(
   fname STRING)
  RETURNING result INTEGER
Checks if a file exists.
os.Path.extension(
   fname STRING)
  RETURNING result  STRING
Returns the file extension.
os.Path.readable(
   fname STRING)
  RETURNING result INTEGER
Checks if a file is readable.
os.Path.writable(
   fname STRING)
  RETURNING result INTEGER
Checks if a file is writable.
os.Path.executable(
   fname STRING)
  RETURNING result INTEGER
Checks if a file is executable.
os.Path.isfile(
   fname STRING)
  RETURNING result BOOLEAN
Checks if a file is a regular file.
os.Path.isdirectory(
   fname STRING)
  RETURNING result BOOLEAN
Checks if a file is a directory.
os.Path.ishidden(
   fname STRING)
  RETURNING result BOOLEAN
Checks if a file is hidden.
os.Path.islink(
   fname STRING)
  RETURNING result BOOLEAN
Checks if a file is UNIX symbolic link.
os.Path.isroot(
   path STRING)
  RETURNING result BOOLEAN
Checks if a file path is a root path.
os.Path.type(
   fname STRING)
  RETURNING result STRING
Returns the file type as a string.
os.Path.size(
   fname STRING)
  RETURNING result INTEGER
Returns the size of a file.
os.Path.atime(
   fname STRING)
  RETURNING result STRING
Returns the time of the last file access.
os.Path.chown(
   fname STRING,
   uid INTEGER,
   gui INTEGER )
  RETURNING result INTEGER
Changes the UNIX owner and group of a file.
os.Path.uid(
   fname STRING)
  RETURNING id INTEGER
Returns the UNIX user id of a file.
os.Path.gid(
   fname STRING)
  RETURNING id INTEGER
Returns the UNIX group id of a file.
os.Path.rwx(
   fname STRING)
  RETURNING mode INTEGER
Returns the UNIX file permissions of a file.
os.Path.chrwx(
   fname STRING,
   mode INTEGER )
  RETURNING result INTEGER
Changes the UNIX permissions of a file.
os.Path.mtime(
   fname STRING)
  RETURNING result STRING
Returns the time of the last file modification.
os.Path.homedir()
  RETURNING homedir STRING
Returns the path to the HOME directory of the current user.
os.Path.rootdir()
  RETURNING rootdir STRING
Returns the root directory of the current working path.
os.Path.dirfmask(
   mask INTEGER)
Defines a filter mask for os.Path.diropen().
os.Path.dirsort(
   criteria STRING,
   order INTEGER )
Defines the sort criteria and sort order for os.Path.diropen().
os.Path.diropen(
   dname STRING)
  RETURNING dirhandle INTEGER
Opens a directory and returns an integer handle to this directory.
os.Path.dirclose(
   dirhandle INTEGER)
Closes the directory referenced by the directory opened by os.Path.diropen().
os.Path.dirnext(
   dirhandle INTEGER)
  RETURNING direntry STRING
Reads the next entry in the directory opened with os.Path.diropen().
os.Path.pwd()
  RETURNING result STRING
Returns the current working directory.
os.Path.chdir(
   newdir STRING)
  RETURNING result INTEGER
Changes the current working directory.
os.Path.volumes()
  RETURNING volumes STRING
Returns the available volumes.
os.Path.chvolume(
   new STRING)
  RETURNING result INTEGER
Changes the current working volume.
os.Path.mkdir(
   dname STRING)
  RETURNING result INTEGER
Creates a new directory.
os.Path.delete(
   dname STRING)
  RETURNING result INTEGER
Deletes a file or a directory.
os.Path.rename(
   oldname STRING,
   newname STRING )
  RETURNING result INTEGER
Renames a file or a directory.
os.Path.copy(
   source STRING,
   dest STRING )
  RETURNING result INTEGER
Creates a new file by copying an existing file.