Skip to main content

Directory scanner

Project description


Quickly scan a directory and yield matching entries, based on patterns and/or entry type.


  • Python 3.4+ (Python 3.6+ is preferred)
  • scandir (for Python 3.4)

The module is tested on Python 3.4 to 3.7 (included).


From PyPI

  • Open a terminal
  • Type pip3 install fsscan
    or pip3 install --user fsscan on Linux

From GitHub

  • Download the archive from GitHub
  • Unzip the archive
  • Open a terminal
  • Move to the directory containing
  • Type pip3 install .
    or pip3 install --user . on Linux


From command line

$ python3 -m fsscan


$ fsscan
usage: fsscan [-h] [-d directory] [-i] [-r] [-t {f,d,b,FILE,DIR,BOTH}] [-f]
              [patterns [patterns ...]]

Quickly scan a directory and yield matching entries.

positional arguments:
  patterns              Patterns to look for in entries names

optional arguments:
  -h, --help            show this help message and exit
  -d directory          Directory to scan
  -i                    Ignore case
  -r                    Recursive scan
  -t {f,d,b,FILE,DIR,BOTH}
                        Type of entry to return
  -f                    Follow symlinks of directories

From script

Using this directory tree sample

    |-- dir1/
    |   |-- logs/
    |   |   |-- file11.log
    |   |--
    |-- dir2/
    |   |-- logs/
    |   |   |-- file21.log
    |   |   |-- file22.log
    |   |--
    |   |--

Example 1 - without parameters

for entry in



Example 2 - with parameters

parameters = {
    "patterns": "*LOG*",
    "ignore_case": True,
    "wanted_type": fsscan.DIR_TYPE,
    "recursive": True,
for entry in<temp_dir>, **parameters):



<exp>*</exp> : The outputs may differ for you OS


    patterns=None, ignore_case=True, wanted_type=BOTH_TYPES,
    recursive=False, on_error=None, follow_links=False, callback=None):

directory : (str or Path)
    Directory to scan
patterns : (str or sequence of str)
    Patterns to look for in entries names
ignore_case : bool
    Ignore case
wanted_type : int
    Type of entry to return (file, directory or both)
recursive : bool
    Recursive scan
on_error : (None or callable)
    Callable to use when an error occured in scandir
follow_links : bool
    Follow symlinks of directories
callback : (None or callable)
    Callable to use after the scan (e.g. entries cast)

    Entries paths as string or callback result

For callbacks, see fsscan/


I would say a big thank you to the people listed below :

Project details

Download files

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

Files for fsscan, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size fsscan-0.0.4.tar.gz (5.2 kB) File type Source Python version None Upload date Hashes View
Filename, size fsscan-0.0.4-py3-none-any.whl (6.4 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page