Skip to main content


Project description

icanhasfile is a Python module that helps you locate and operate on files using glob searches.


To install icanhasfile, simply:

$ pip install --pre icanhasfile


To get the help dialog, run one of the following commands:

$ icanhasfile --help
$ icanhasfile -h
$ icanhasfile -?

The general command syntax is below. For a list of options, see the help dialog.

$ icanhasfile [options] <path> <filepattern>


As an example, let’s say we have the following directory structure:

+-- pom.xml
+-- LICENSE.txt
+-- dir1/
|   |
|   \-- pom.xml
+-- dir2/
|   |
|   +-- pom.xml
|   +-- pom-changes.xml
|   \-- version.txt
+-- dir3/
    \-- context.xml

If you are searching for pom.xml and want to give the absolute path to the top-level directory, issue the command below. You will be prompted to choose from three matching files:

$ icanhasfile /path/to/top-level/dir pom.xml
[0] pom.xml
[1] dir1/pom.xml
[2] dir2/pom.xml
Choose a number (q to quit):

If you are in the top-level directory and are searching for pom*.xml, issue the command below. You will be prompted to choose from four matching files:

$ icanhasfile . 'pom*.xml'
[0] pom.xml
[1] dir1/pom.xml
[2] dir2/pom-changes.xml
[3] dir2/pom.xml
Choose a number (q to quit):

By default, the selected file will be opened using your $EDITOR. However, you can also provide a –command option to use a different command on your path. In the example below, we will just cat out the file. Also, as it is run in the icanhasfile source directory and there is only a single matching file, the file is cat’d without asking the user to choose from multiple matching files:

$ --command cat .
include LICENSE.txt
include README.rst

Project details

Release history Release notifications

History Node


This version
History Node

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date (4.6 kB) Copy SHA256 hash SHA256 Source None Jul 24, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page