Facade for basic find tool that recursively matches files by globs
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Klepto prints files in the file system matching at least one glob using fnmatch, starting in the working directory.

I made this solely for convenience after getting tired of bending native shell search commands to the use cases shown below.

How it works

In the most basic case, Klepto prints absolute paths to files that match a glob. Klepto will check every file in the working directory, and all files in subdirectories recursively.

$ cd ~/code
$ klepto "*.js"


You may exclude a directory from the output.

$ klepto --exclude extra "*.js"


You may exclude more than one directory, if desired.

$ klepto --exclude extra --exclude subdir "*.js"


Klepto can match against multiple globs. By default, klepto prints files that match any of the specified globs.

$ klepto --exclude extra "*.js" "*.css"


However, you can specify that klepto prints files that match ALL globs. This example prints only .js files in subdir.

$ klepto --all "*.js" "*subdir*"


This is almost the same as saying klepto "*subdir/*.js".

You can also count the number of results.

$ klepto --all --number "*.js" "*subdir*"

Finally, you can print relative paths.

$ klepto --all --relative "*.js" "*subdir*"


  • To avoid unwanted wildcard expansions, be sure to quote or escape your globs.
  • Globs match against the absolute path to each candidate file. klepto "mydir/*.txt" will have no output, but klepto "*mydir/*.txt" will.

Command line reference

klepto [-h] [-e EXCLUDE] [-c CONFIG] [-a] GLOB [GLOB ...]
  • GLOB: Positional sequence of at least one glob used when matching files.
  • --exclude/-e: Specifies the name of one directory to never scan when matching files. You may specify --exclude multiple times to exclude more than one directory.
  • --config/-c: Specifies location of JSON-serialized config file. Defaults to ~/.kleptorc.json. See Configuration
  • --all/-a: If set, prints only files that match all globs, instead of files that match any one glob.
  • --relative/-r: If set, prints relative paths to files instead of absolute paths.
  • --number/-n: If set, prints number of matches instead of paths.


Store configuration data in a JSON-serialized file. An example config file might look like this:

	"exclude": [

You can specify the location of this file using --config or -c.

$ klepto --config /path/to/config.json

By default, klepto will look for a ~/.kleptorc.json if you do not specify a config file.

Configuration properties

  • exclude - Array of directory names to never include in the output. These are not globs. If you specify directory names using --exclude/-e, they will merge with the names specified in the config file.