A lightweight, modular Python library for efficient file and directory management. pyfiletools offers utilities for analysis, hashing, duplicate detection, text search, file organization, renaming, encoding conversion, and reports.
- File Analysis & Stats: Line counting, byte-size calculations, and file extensions.
- Hashing & Integrity: Memory-safe hashing (
MD5,SHA-1,SHA-256,SHA-512) and validation. - Search: Text and regex searching within files, with filter options.
- File Management: Duplicate detection and directory organization.
- Automation: Batch renaming and safe encoding conversions.
- Reports: Generate file system reports (JSON, CSV, Markdown).
git clone https://github.com/v80dn/pyfiletools.git
cd pyfiletools
pip install .Requires Python 3.10+
from pyfiletools import count_lines, file_size, format_size, file_hash
# Basic Analysis
path = "example.txt"
print(f"Lines: {count_lines(path)}")
print(f"Size: {format_size(file_size(path))}")
# Hashing
hash_val = file_hash(path, algorithm="sha256")pyfiletools/: Core package (archives, duplicates, hashing, search, etc.)tests/:pytestautomation suitepyproject.toml: Project metadata
pip install pytest
pytestMIT License.