Skip to main content

an efficient python path API for walking a filesystem with generators

Project description

Pathtool: An efficient Python Path API

:Author: Noah Gift
:Version: $Revision: 0.1.0 $
:Copyright: This document has been placed in the public domain.


Pathtool is an efficient API to walking a filesystem, and it aims to be
very simple, yet powerful. By calling path you can pass it a path to a
filesystem, apply an optional unix style pattern filter, and an optional
action callback function.

This allows you do to powerful things to a filesystem in one line of code!

There is a record dictionary that contains useful key/value combinations such
as a unique_id hash, ctime, mtime, size, and extension. These records can easily
be used to create custom action callbacks. Additionally a future API will integrate
chainable actions.

.. contents::

Example Usage:

from pathtool import path
path("/tmp", filter=".mp3")

This would search the /tmp directory and return the path to all matches to the *.mp3
pattern. This is because it is using a default callback action that just prints out
the path to a match. You can create your own callback and do things like create tar
archives, delete files, move files, deduplicate files, compare sizes, etc.

The API is subject to some small changes, so no promises for now.

QUESTIONS: noah dot gift at

Project details

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page