Skip to main content

Filesystem audit tool — scan, classify, analyze, and report on directory contents

Project description

FSAudit

Filesystem audit tool that scans, classifies, analyzes, and generates Excel reports from directory metadata.

FSAudit operates exclusively on filesystem metadata (timestamps, sizes, permissions) -- it never reads file contents. The tool is read-only by design and requires no elevated privileges.

Features

  • Recursive directory scanning with depth limits and exclusion patterns
  • Extension-based file classification into semantic categories
  • Temporal analysis: monthly distribution, inactive file detection
  • Volume analysis: per-category and per-directory breakdowns
  • Alert detection: empty files, empty directories, hidden files, duplicate names
  • Multi-sheet Excel report with KPI dashboard
  • Cross-platform support (Linux and Windows)

Installation

pip install .

For development:

pip install -e ".[dev]"

Requires Python 3.10+.

Usage

Basic audit of a directory:

fsaudit --path ~/Documents

Custom output directory and depth limit:

fsaudit --path ~/Projects --output-dir ~/reports --depth 5

Exclude patterns and filter small files:

fsaudit --path ~/work --exclude node_modules --exclude .git --min-size 1024

Set inactive threshold and enable debug logging:

fsaudit --path /home/user --inactive-days 180 --log-level DEBUG --log-file audit.log

Output file naming

Reports are saved as {folder_name}_audit_{YYYY-MM-DD}.xlsx. For example, auditing ~/Documents on 2026-03-29 produces:

Documents_audit_2026-03-29.xlsx

CLI Flags

Flag Required Default Description
--path Yes -- Root directory to audit
--output-dir No . (current directory) Directory for the output report
--depth No Unlimited Maximum recursion depth
--exclude No None Directory/file patterns to exclude (repeatable)
--min-size No 0 Minimum file size in bytes to include
--inactive-days No 365 Days without modification to classify a file as inactive
--log-level No INFO Logging verbosity: DEBUG, INFO, WARNING, ERROR
--log-file No None (stderr only) Path to log file

Excel Report Sheets

The generated .xlsx workbook contains 8 sheets:

Sheet Content
Dashboard KPI overview: total files, total size, category counts
Por Categoria File count and size breakdown by category
Timeline Monthly distribution of files by modification date
Top Archivos Pesados Largest files ranked by size
Archivos Inactivos Files not modified within the inactive-days threshold
Alertas Warnings: empty files, empty directories, hidden files, duplicate names
Por Directorio Top directories ranked by total volume
Inventario Completo Full file listing with all metadata and autofilter

File Categories

Files are classified by extension into these categories:

Category Extensions (sample)
Oficina .docx, .xlsx, .pptx, .pdf, .csv, .odt, .ods, .rtf
Codigo .py, .js, .ts, .java, .go, .rs, .html, .css, .json, .yaml, .md
Multimedia .jpg, .png, .gif, .svg, .mp4, .mp3, .wav, .mkv, .webm
Datos .db, .sqlite, .parquet, .arrow, .pickle, .h5, .hdf5
Comprimidos .zip, .tar, .gz, .tar.gz, .tar.bz2, .7z, .rar
Ejecutables .exe, .msi, .deb, .rpm, .appimage, .bat, .ps1
Sistema .log, .ini, .cfg, .conf, .env, .lock, .tmp, .bak
SinExtension Files with no extension
Unclassified Any extension not matching the above

The full mapping is defined in src/fsaudit/classifier/categories.yaml.

Architecture

FSAudit implements a modular pipeline pattern where each stage is stateless and independently testable:

CLI --> Scanner --> Classifier --> Analyzer --> Reporter
Module Responsibility
cli.py Argument parsing, input validation, pipeline orchestration
scanner/ Recursive filesystem walk, metadata extraction, platform-aware timestamps
classifier/ Extension-to-category mapping from YAML config
analyzer/ Metric computation: category stats, timeline, top files, inactive detection, alerts
reporter/ Excel workbook generation via openpyxl
src/fsaudit/
    __init__.py
    cli.py
    logging_config.py
    analyzer/
        analyzer.py
        metrics.py
    classifier/
        classifier.py
        categories.yaml
    reporter/
        base.py
        excel_reporter.py
    scanner/
        scanner.py
        models.py
        platform_utils.py

Development

Run tests:

pytest

Run tests with coverage:

pytest --cov=fsaudit

License

TBD

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fsaudit-0.1.1.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fsaudit-0.1.1-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file fsaudit-0.1.1.tar.gz.

File metadata

  • Download URL: fsaudit-0.1.1.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for fsaudit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 55e1395840a65f1bbe88e7442bc5e05930f218f0b901b96d874a166e7ea4db49
MD5 b7c6db7758a0ea04de06d02561b1db25
BLAKE2b-256 284062726c0bad38f3c0163d34bc949125628f47986645ba73a5cb2786f37ca4

See more details on using hashes here.

File details

Details for the file fsaudit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fsaudit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for fsaudit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c0fa3479727102c3334ddf6b3d9212e8a431c30a01b635eb0fe53654cea6897
MD5 3aa19f11903c5de9d3b180655cc95ec4
BLAKE2b-256 2dec3fde64ece5c1007c8122a907b25f0909cfaa0f1e99e73c790f592202b22e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page