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 pathquery
for path in pathquery("yourdir").ext("js") - pathquery("yourdir/node_modules"):
path.chmod(0755)
Install
To use:
$ pip install pathquery
API
Path properties can be inspected as part of the query:
pathquery("yourdir").is_dir()
pathquery("yourdir").is_not_dir()
pathquery("yourdir").is_symlink()
pathquery("yourdir").is_not_symlink()
Queries are also chainable:
for path in pathquery("yourdir").ext("pyc").is_symlink() - pathq("yourdir/node_modules"):
path.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.3.0.tar.gz
(3.1 kB
view details)
File details
Details for the file pathquery-0.3.0.tar.gz.
File metadata
- Download URL: pathquery-0.3.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ea0f39aae038016af618725248b12d10848e63f62f8049dd47a04623eeb3a63
|
|
| MD5 |
42933f8c88a3d2d09d756ef9dcee5918
|
|
| BLAKE2b-256 |
6c9420a19307727a7da899e8a00bb790d45d67ba30022ce3caa8874fae4d3bc7
|