Skip to main content

FSS will recursively scan the given directory for matching files and yield results as a generator. You may provide a list of include/exclude rules for files and/or directories.

The searching is done asynchronously from another process. This way, the searching and whatever you’re doing with the results may potentially run in parallel.

Usage

As Library

Example:

import fss.constants
import fss.config.log
import fss.orchestrator

root_path = '/etc'

filter_rules = [
    (fss.constants.FT_DIR, fss.constants.FILTER_INCLUDE, 'init'),
    (fss.constants.FT_FILE, fss.constants.FILTER_INCLUDE, 'net*'),
    (fss.constants.FT_FILE, fss.constants.FILTER_EXCLUDE, 'networking.conf'),
]

o = fss.orchestrator.Orchestrator(root_path, filter_rules)
for (entry_type, entry_filepath) in o.recurse():
    if entry_type == fss.constants.FT_DIR:
        print("Directory: [%s]" % (entry_filepath,))
    else: # entry_type == fss.constants.FT_FILE:
        print("File: [%s]" % (entry_filepath,))

Output:

Directory: [/etc/init]
File: [/etc/networks]
File: [/etc/netconfig]
File: [/etc/init/network-interface-container.conf]
File: [/etc/init/networking.conf]
File: [/etc/init/network-interface-security.conf]
File: [/etc/init/network-interface.conf]

Notice that even though we only include directories named “init” we’ll still see matching files from the root-path.

As Script

You can also use FSS from the command-line. You’ll get a printout of the results that you can consume and parse.

Example:

$ pathscan -i "i*.h" -id php /usr/include
F /usr/include/iconv.h
F /usr/include/ifaddrs.h
F /usr/include/inttypes.h
F /usr/include/iso646.h
D /usr/include/php

Requirements

  • Python 3.4

Installation

PyPI:

$ sudo pip3 install pathscan

Release files for pathscan 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pathscan 0.2.2
File Size Uploaded
pathscan-0.2.2.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pathscan 0.2.2
File Interpreter ABI Platform
pathscan-0.2.2-py2-none-any.whl Python 2 none any Details

Total release size: 23.1 kB

Release files / pathscan-0.2.2.tar.gz

Download URL pathscan-0.2.2.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4846ef754a54ef61077175f06a0bd5efe8d532e4c6ce17236d029acd6cd773ce
BLAKE2b-256 checksum
How to use checksums
e2beeecc08e2331b6502501261abcbbd1e0145cf9e30d24cb952450d1de53db7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pathscan-0.2.2-py2-none-any.whl

Download URL pathscan-0.2.2-py2-none-any.whl
Size 14.3 kB
Tags Python 2
SHA-256 checksum
How to use checksums
365f1551397989d5ce6f3064ababe3b8dc9d7eff89819f5e96a5c5c86146ef3b
BLAKE2b-256 checksum
How to use checksums
0c76e38d8dd7ee5bae9683ae1bd810e7cce0cd3604c51f18eb121ffc105e8a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page