Skip to main content

A tool for finding files in the filesystem

Project description

ff

About

ff is a tool for finding files in the filesystem.

NOTE: ff is in the early stages of development, expect things to break and syntax to change.

Summary

ff is a tool for finding files in the filesystem that all share a set of common features. Its scope is similar to find(1) and fd(1) but it aims at being more accessible and easier to use than find and more versatile and powerful than fd. It is written in Python >= 3.6.

Features

  • Search by file attributes.
  • Search in a wide variety of file metadata.
  • Simple yet powerful expression syntax.
  • Flexible output options.
  • Flexible sort options.
  • Extendable by user plugins.
  • Parallel search and processing.
  • Usable in scripts with a Python API.

Examples

Store all files from the current directory that are tracked by git(1) in a tar(1) archive:

$ ff type=f git.tracked=yes --sort --exec-batch tar cvzf git-tracked.tar.gz

Find files in the directory Videos/ that end with .mkv or .mp4 and are between 720 and 1080 pixels high:

$ ff Videos/ {{ ext=mkv or ext=mp4 }} and {{ height+=720 and height-=1080 }}

More examples are here.

Installation

To build and install ff simply type:

$ python setup.py install

or

$ pip install find-ff

Building with Cython is also supported. Cython >= 3.0 is required. Depending on the set of arguments this may offer a significant speed-up.

$ python setup-cython.py install

Python API

You can use ff's query capabilities in your own scripts:

from ff import Find

for entry in Find("type=f git.tracked=yes", directories=["/home/user/project"], sort=["path"]):
    print(entry["relpath"])

Developing plugins and debug mode

There is a template for new plugins to start from (plugin_template.py) with exhaustive instructions and comments, so you can develop plugins for your own needs.

Useful in that regard is ff's debug mode. It can be activated by executing the ff module.

$ python -m ff --debug info,cache ...

Debug mode produces lots of messages which can be limited to certain categories using the --debug category1,category2,... option. On top of that, debug mode activates many internal checks using assert(). Therefore, it is advisable to use debug mode during plugin development.

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

find-ff-595.tar.gz (76.7 kB view hashes)

Uploaded Source

Built Distribution

find_ff-595-py3-none-any.whl (120.4 kB view hashes)

Uploaded Python 3

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