Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A fork of
Failed to load latest commit information.
tests Changed imports in tests
README.rst Added a little more to the documentation Added temp_sys_argv Incremented version number


A fork of Jason Orendorff's excellent With the intention of giving it greater availabilty, tests, documentation and also bringing in some of the simpler parts of twisted.python.filepath.

This module provides a subsclass of string (or unicode) with utility methods that provide easy access to most of os.path, and the relevant parts of os.


>>> from path import path
>>> tmp_dir = path('/tmp/')
>>> tmp_dir
>>> tmp_dir_existed = tmp_dir.exists()
>>> tmp_dir == '/tmp/'
>>> sub_dir = tmp_dir + 'sub_dir/'
>>> sub_dir
>>> sub_dir.makedirs()
>>> file1 = sub_dir + 'file1.txt'
>>> file1.touch()
>>> file2 = sub_dir + 'file2.txt'
>>> file2.touch()
>>> for f in sub_dir.files():
...     print f
>>> for f in sub_dir.files():
...    f.remove()
>>> sub_dir.files()
>>> sub_dir.rmdir()
>>> sub_dir.exists()
>>> if not tmp_dir_existed:
...     tmp_dir.rmdir()

This module should be as stable as the last release of (2.2), and I am gradually adding regression tests to ensure that compatabilty is kept going forward. However this module itself isn't being used in production yet, and hasn't been tested thoroughly on Windows, so some caution should be taken for now.

I'm happy to take any suggestions, criticism, advice or comments. For now, email me at or use the messages on github.

Something went wrong with that request. Please try again.