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.8.2.tar.gz (75.2 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.8.2-py3-none-any.whl (49.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fsaudit-0.8.2.tar.gz
Algorithm Hash digest
SHA256 18e170ce7196e942222edebbba0d441599452a5d06ff5764b0f63c42d82edc48
MD5 eb13f89432ed7e12751ce25658d9cbea
BLAKE2b-256 a69c0cde10e40a51f2fad4207f1caef425f54eb96196f93783356bb1323a5a27

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fsaudit-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 49.6 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.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0e852be4e5e63399644153f3c949a79ee8f32f22986500d4454e28fcb493f308
MD5 f88c04e295415a768512af5cd56aa2f6
BLAKE2b-256 5a21a3ab4af8f4239148692d6d299723407acf4610f0029c77ab86788b54c0c3

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