The os.Path class

The os.Path class provides functions to manipulate files and directories on the machine where the program executes.

This class is provided in the util C-Extension library. To use the os.Path extension, you must import the os package in your program:

In order to manipulate files, this API gives you access to low-level system functions. Pay attention to operating system specific conventions like path separators.


Some methods are OS specific, like os.Path.rwx() which works only on UNIX systems. Other methods may behave differently, depending on the OS. For example, the os.Path.rename() method cannot rename a file across file systems on a UNIX platform.