1. Dmitri Lebedev
  2. fsquass


fsquass /

Filename Size Date modified Message
239 B
1.6 KB
957 B

FsQuass, file system querying library

Much more info on Read the Docs.


This library is a syntactic sugar of os.path and fnmatch, and can do smart searches of files, using such techniques as

  • space-separated ancestor & descendant like in CSS, /home fsquass/fsquass
  • bash-like subpatterns, /{home,tmp}/user
  • CSS-like pseudo-classes, :file, :dir, :ignorecase


Command line interface:

$ fsquass ". *.py"

$ fsquass "/home/*/.bashrc"

This is similar to unix find. What new does FsQuass offer? Here are cool things hard to do with find: find all folders that are legitimate Pytohn packages, i.e. have a __init__.py in them:

$ fsquass ". *:dir/__init__.py/.."

Now if I want to do something with them, I use xargs. I can list those directories:

$ fsquass ". *:dir/__init__.py/.." | xargs ls

Or copy them:

$ fsquass ". *:dir/__init__.py/.." | xargs -I '{}' cp -R {} /tmp

You can import fsquass and use it in Python:

from fsquass import Fs
repair_photos = Fs('~/Pictures/{2010,2011}/*repair *.jp?g:ignorecase:file')

packages_with_setup = Fs('. setup.py').parents()
# and so on


Install the package with setup.py or with your python package manager:

python setup.py install