Skip to main content

fileindex

A fast, efficient command-line tool for local file indexing and searching with intelligent caching and duplicate detection.

Features

  • Lightning-fast indexing: Recursively scans directories and creates a comprehensive file index
  • Smart caching: Caches results locally for instant searches without re-scanning
  • Incremental updates: Re-scan only modified files using timestamps and sizes
  • Content-based deduplication: Detect duplicate files using SHA256 hashing
  • Advanced filtering: Search by name, extension, size range, and path
  • Chained filters: Combine multiple filters to refine search results
  • Beautiful CLI: Color-coded output with clear status messages
  • Zero dependencies: Pure Python implementation using only standard library
  • Cross-platform: Works on Windows, macOS, and Linux
  • Easy installation: Single command to install as a system command

Installation

pip install fileindex

That's it! You can now use fileindex from anywhere:

fileindex scan ~/projects
fileindex search main

Other Installation Methods

Using uv (fastest project add):

uv add fileindex
uv run fileindex scan .

Using uv as a global tool:

uv tool install fileindex
# ensure uv's bin dir is on PATH, then
fileindex scan .

Using pipx (isolated CLI tool):

pipx install fileindex
fileindex scan ~/projects

From source (development):

git clone https://github.com/Dhritikrishna123/file-index.git
cd fileindex
pip install -e .

System Requirements

  • Python: 3.8 or higher
  • OS: Windows, macOS, or Linux
  • Disk: ~100 KB for the package

After install, running fileindex should show the welcome screen with commands.

Quick Start

# Index a directory
fileindex scan ~/projects

# Search files
fileindex search main
fileindex search document --ext pdf

# View cache status
fileindex status

# Find duplicates
fileindex dup

# Clear cache
fileindex cache clear

Commands Reference

scan <path>

Index a directory and cache the results.

fileindex scan ~/my_project

Features:

  • Recursively walks directory tree
  • Skips: .git, __pycache__, node_modules
  • Computes SHA256 hash for each file
  • Incremental scanning: reuses cached hashes

search <query>

Search indexed files.

fileindex search main
fileindex search config --ext json
fileindex search . --ext py --path src --min-size 1000 --limit 20

Filters:

  • --ext <ext> - Filter by extension
  • --path <substring> - Filter by path
  • --min-size <bytes> - Minimum file size
  • --max-size <bytes> - Maximum file size
  • --limit <n> - Limit output (default: 10)

status

Display cache information.

fileindex status

dup

Find all duplicate files based on content hash.

fileindex dup

cache clear

Clear the cached index.

fileindex cache clear

Usage Examples

# Find all Python files
fileindex scan ~/projects
fileindex search . --ext py --limit 100

# Locate large log files
fileindex search log --min-size 10000000

# Search in specific directory
fileindex search config --path /etc

# Find duplicates
fileindex scan ~/projects && fileindex dup

# Combined search
fileindex search . --ext py --path src --min-size 5000

Cache Location

  • Linux/macOS: ~/.fileindex/index.json
  • Windows: C:\Users\<YourUser>\AppData\Roaming\.fileindex\index.json

Performance

  • Scanning: ~1000-5000 files/second
  • Searching: Instant (<100ms for cached index)
  • Memory: Minimal, streaming operations
  • Incremental scan: 50-90% faster than full scan

Architecture

Core Modules

  • fileindex.core.scan - Directory scanning with SHA256 hashing
  • fileindex.core.search - Advanced search and filtering
  • fileindex.core.cache - Persistent JSON caching
  • fileindex.cli.style - Terminal styling and colors
  • fileindex.cli.welcome - Welcome screen and help

Data Structure

Each file record contains:

{
    "name": "file.txt",
    "path": "/full/path/file.txt",
    "ext": "txt",
    "size": 2048,
    "mtime": 1609459200.0,
    "hash": "abc123def456..."  # SHA256
}

Testing

Run the comprehensive test suite:

python3 -m unittest discover -s tests -p "test_*.py" -v

Support & Issues

61+ tests covering:

  • Directory scanning
  • Search functionality
  • Caching systems
  • CLI styling
  • Integration workflows

Project Structure

fileindex/
├── fileindex/              # Main package
│   ├── __init__.py
│   ├── __main__.py
│   ├── main.py
│   ├── cli/
│   │   ├── style.py
│   │   └── welcome.py
│   └── core/
│       ├── scan.py
│       ├── search.py
│       └── cache.py
├── tests/                  # Test suite (61+ tests)
├── README.md
├── (dist/ created when you build)
├── LICENSE
├── setup.py
└── pyproject.toml

Platform Support

  • ✅ Linux
  • ✅ macOS
  • ✅ Windows

The fileindex command works identically across all platforms.

Troubleshooting

Command Not Found

# Check installation
pip list | grep fileindex

# Check PATH
echo $PATH  # Linux/Mac
echo %PATH%  # Windows

# Reinstall
pip uninstall fileindex
pip install fileindex

Permission Issues (Linux/Mac)

pip install --user fileindex

License

MIT License - See LICENSE file

Roadmap

  • Config file support for custom ignore patterns
  • Regex-based search
  • SQLite database backend
  • Watch mode for real-time indexing
  • CSV/JSON export
  • Parallel scanning
  • Fuzzy matching

Notes

  • All file paths are absolute
  • Search is case-insensitive
  • File hashing uses SHA256
  • Supports Python 3.8+
  • Zero external dependencies

Metadata

Release files for fileindex 0.1.0

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

Source distribution (sdist)

Source distribution for fileindex 0.1.0
File Size Uploaded Provenance Actions
fileindex-0.1.0.tar.gz 18.8 kB Without provenance Details for fileindex-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fileindex 0.1.0
File Interpreter ABI Platform Actions
fileindex-0.1.0-py3-none-any.whl Python 3 none any Details for fileindex-0.1.0-py3-none-any.whl

Total release size: 30.9 kB

Release files / fileindex-0.1.0.tar.gz

Download URL fileindex-0.1.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
038022ec249b849d3f5d233538cd9c769494723ca0e8813afba047a71738f4a0
BLAKE2b-256 checksum
How to use checksums
67703040024cdb31e298397708ae4d21f28a38984af61b6c15b405372ee5f080
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / fileindex-0.1.0-py3-none-any.whl

Download URL fileindex-0.1.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3516dd4fb6afe7435bfd2420f65ea1dd64e8ff661ec1b72b1df807ef329c3408
BLAKE2b-256 checksum
How to use checksums
1838344019c32541d2f672d5e49780e65862bc388d6b79f5468f61f5d6a0c1b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for fileindex 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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