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
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pathscan-0.2.2.tar.gz | 8.8 kB | Without provenance | Details for pathscan-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pathscan-0.2.2-py2-none-any.whl | Python 2 | none | any | Details for pathscan-0.2.2-py2-none-any.whl |
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 |
Security for pathscan 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.