fastfind
fastfind is a lightweight python library that lets you search files or directories extremely fast on Windows/Linux in your code while providing high customizability.
Installation
Use the following command to install fastfind:
pip install fastfind
Usage
Make sure to first import the library before using it in your code.
import fastfind
Then you can search for a file/folder by using:
result = fastfind.search(query="hidden_file", search_type="any", max_results=1000, timeout=5.0, roots=["C:\\Users"], all_dirs=True, max_files_per_dir=30, exact_match=True, exclude_folders=["C:\\Program_Files"], exclude_keywords=[".txt"])
| Argument | Datatype | Explanation | Default Value |
|---|---|---|---|
| query | str | The name of the file/folder you want to search for. Here you can use Wildcards! | Required |
| roots | list[str] or None | The root directories to search, if None are provided all drives and folders will be searched. | None |
| exact_match | bool | When set to True, the given query has to exactly match the file/folders name instead of just containing it. | False |
| search_type | str, use: "any", "file" or "dir" | Whether you want to search only for files, folders or both. | any |
| max_results | int | How many results will be returned before stopping. | 1000 |
| timeout | float | The time in s of how long it takes before the library times out and stops searching. | 5.0 |
| all_dirs | bool | If set to True, all files, including system files, will be searched that would otherwise wouldn't be searched due to better performance. | False |
| max_files_per_dir | int or None | Limts how many files can be output from one single directory. | None |
| exclude_folders | list[str] or None | Folders whose content will be excluded in the search. The folder itself can still be found. All subfolders will still be searched. This is not affected by using all_dirs. | None |
| exclude_keywords | list[str] or None | Excludes results that have these given keywords in them. Here you can use Wildcards! | None |
[!IMPORTANT] When you want to include all subfolders of a folder in "exclude_folders" or "roots" use '/Folder/Path/.' ! When only using '/Folder/Path/' all subfolders will still be searched (exclude_folders) or won't be searched (roots):
| Example | C:/Users | C:/Users/User | C:/Users/User/documents | C:/Users/User/file.txt |
|---|---|---|---|---|
| exclude_folders=[r"C:/Users"] | visible | hidden | visible | visible |
| exclude_folders=[r"C:/Users/."] | visible | hidden | hidden | hidden |
Wildcards
In the arguments query and exclude_keywords you can choose to use the wildcards * and ?.
* : Stands for any formation of letters/numbers/symbols of any length. So query="h*e" would return house and handsome.
? : Stands for one single character of any kind (letter/number/symbol). So query = "b?ll" would return ball and bell
Release files for fastfind 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastfind-1.0.0.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastfind-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.9 kB
Release files / fastfind-1.0.0.tar.gz
| Download URL | fastfind-1.0.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d95793447ea4ee0939c00669391ab7fe76a2eb0a1ede809dea8811b389a01cf
|
|
BLAKE2b-256 checksum How to use checksums |
12f99b2c925263544964d41d8a022851f5269becd18cb1cd53834839bfffddfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / fastfind-1.0.0-py3-none-any.whl
| Download URL | fastfind-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54a54088733484ebd3485645fb8fc64376d746f962fa216f551cc710b1c60632
|
|
BLAKE2b-256 checksum How to use checksums |
e480ad3014d5ddad594a11c8dc49ef2a0562c6edeea8b42178deefea055805b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|