Skip to main content

PathQuery is a tool to declaratively define file searches.

Project description

PathQuery is a tool to declaratively define file searches that returns a list of path.py Path objects.

Example

Search for all files recursively except in the node_modules folder and change its perms:

from pathquery import pathq

for p in pathq("yourdir").ext("js").but_not(pathq("yourdir/node_modules)):
    p.chmod(0755)

Install

To use:

$ pip install pathquery

API

Path properties can be inspected as part of the query:

pathq("yourdir").is_dir()
pathq("yourdir").is_not_dir()
pathq("yourdir").is_symlink()
pathq("yourdir").is_not_symlink()

Queries are also chainable:

for p in pathq("yourdir").ext("pyc").is_symlink().but_not(pathq("yourdir/node_modules")):
    p.remove()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pathquery-0.2.2.tar.gz (2.9 kB view hashes)

Uploaded Source

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