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.1.tar.gz (76.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.1-py3-none-any.whl (50.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fsaudit-0.8.1.tar.gz
  • Upload date:
  • Size: 76.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.1.tar.gz
Algorithm Hash digest
SHA256 ac6951ffef92f90de8023cd64a5bea1ad4bfcb640ed9f02d851a6380990aff83
MD5 3730373c7f6488e6236c24b2597bf670
BLAKE2b-256 1834315b6840124ffb0a41febff0a507424978f1ba3112b1f197ebf28f8425dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fsaudit-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 50.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c23e245e06a3a353fd9f7e4baec75d7a3b8f5d5af73e56e7f20544717dc3825
MD5 282c3c19c49177a2594ddfda4d2dd3cb
BLAKE2b-256 e61e03b766f530868a0cabdad466704227c5f664ece642b08a792649a49c5e14

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