Skip to main content

findx - an extended find command.

https://travis-ci.org/drmikehenry/findx.svg https://img.shields.io/pypi/v/findx.svg https://img.shields.io/pypi/status/findx.svg https://img.shields.io/pypi/pyversions/findx.svg

Overview

findx is an extended version of the Unix find command written in the Python language as a wrapper around find and other Unix tools. find is a very powerful tool, but by itself there are a large number of arguments required for a typical invocation. findx provides convenient shortcuts for invoking find without so much typing.

As a quick example, imagine using find, xargs and grep to search through a tree of files. A simple invocation might be:

find -type f | xargs grep PATTERN

But the above invocation won’t correctly handle file with spaces or unusual characters; handling that grows the command to:

find -type f -print0 | xargs -0 grep PATTERN

Filenames are handled correctly now, but the command probably searches through some uninteresting files. It also misses on a couple of boundary cases. You’d probably like to include xargs --no-run-if-empty to ensure grep isn’t invoked when no files are found; you might want to follow symbolic links as well as files; and you might want to skip over .git directories (for example). Adding those into the above command grows things considerably:

find -L -name .git -prune -o -type f -print0 |
  xargs -0 --no-run-if-empty grep PATTERN

After excluding additional files and directories and perhaps adding --color=auto to the grep invocation, things are getting out of hand. findx exists to make such invocations simpler. First, findx knows about the need for -print0 and xargs -0 --no-run-if-empty; using : implies all of the standard protocol for using xargs correctly, reducing the above to:

findx -L -name .git -prune -o -type f : grep PATTERN

Standard paths to ignore are requested via -stdx:

findx -L -stdx -type f : grep PATTERN

Following symlinks to files and producing only files is another common requirement; the switch -ffx implies finding files (following symlinks) while excluding a predefined set of directories and files:

findx -ffx : grep PATTERN

Piping filenames into grep is such a common pattern that the -ffg switch is the same as -ffx : grep, reducing things to:

findx -ffg PATTERN

In addition, ffx and ffg are to additional entry points into findx that reduce things even further:

ffx = findx -ffx
ffg = findx -ffg

In the most common case, searching a file tree thus reduces to:

ffg PATTERN

See findx --help or read the top of findx.py for more details.

Installation

From PyPI, installation is the usual:

pip install findx

From the source tree, install via:

python setup.py install

Running the tests

Install any development requirements:

pip install -r dev-requirements.txt

Run tests via pytest:

pytest

Changes

See CHANGES.rst for a history of changes.

License

findx is distributed under the terms of the MIT license; see LICENSE.rst for details.

Metadata

Release files for findx 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for findx 0.12.0
File Size Uploaded Provenance Actions
findx-0.12.0.tar.gz 65.0 kB Without provenance Details for findx-0.12.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for findx 0.12.0
File Interpreter ABI Platform Actions
findx-0.12.0-py3-none-any.whl Python 3 none any Details for findx-0.12.0-py3-none-any.whl

Total release size: 82.5 kB

Release files / findx-0.12.0.tar.gz

Download URL findx-0.12.0.tar.gz
Size 65.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3a4a8a81f15c15e8a0a9b5ea98d082795a7654c913f1dc2ce72629287d82c725
BLAKE2b-256 checksum
How to use checksums
854a14826554c59488f637697efb65c4a0669d2c76ae008ff03c645146c7f00e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.2

Release files / findx-0.12.0-py3-none-any.whl

Download URL findx-0.12.0-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30ed62a4b16c095010220ef1aee8e26e8197b541d01bafb6cbf2b5c6560737cb
BLAKE2b-256 checksum
How to use checksums
cb95def01af62fab087f7e1ef84973ca942070e5df6af1f34641753f5e9bdd69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.2

Security for findx 0.12.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page