Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Folder Compare

Compare 2+ project folder structures for CAD/engineering workflows — normalizes filenames by stripping project prefixes and site suffixes, detects missing/extra/renamed files with fuzzy matching, reports size mismatches, and exports detailed CSV reports.

Features

  • Multi-folder comparison — compare 2 or more folders simultaneously
  • Filename normalization — strips project number prefixes and site name suffixes for accurate cross-folder matching
  • Auto-detection — scans files to automatically detect project prefixes and site suffixes
  • Fuzzy matching — catches probable matches for renamed or mistyped files (configurable threshold)
  • File size comparison — flags files that match by name but differ significantly in size
  • Case sensitivity detection — flags case-only differences between matching files
  • Exclusion system — skip Logs folders, .bak files, and custom wildcard patterns
  • Detailed scan statistics — per-folder breakdown of included, excluded, and empty folders
  • CSV export — comprehensive report with match categories, file metadata, and exclusion details
  • Dual mode — GUI (default) or CLI for headless/scripted use
  • Threaded GUI — scanning runs in background thread, UI stays responsive
  • No third-party dependencies (Python stdlib only, tkinter for GUI)

Requirements

  • Python 3.8+
  • GUI mode requires tkinter (included with standard Python on Windows/macOS)

Usage

GUI Mode

# Launch GUI (no arguments)
python folder_compare.py

# Force GUI mode
python folder_compare.py --gui

CLI Mode

# Basic comparison of two folders
python folder_compare.py "C:\Site1" "C:\Site2"

# Compare three folders with custom output
python folder_compare.py "C:\Site1" "C:\Site2" "C:\Template" -o report.csv

# Specify prefix and suffixes explicitly
python folder_compare.py "C:\Site1" "C:\Site2" --prefix "25012218-" --suffixes "Anna,Clinton"

# Filter to only .dwg files
python folder_compare.py "C:\Site1" "C:\Site2" -e ".dwg"

# Include Logs folders and .bak files
python folder_compare.py "C:\Site1" "C:\Site2" --include-logs --include-bak

Options

folders                 Folders to compare (2+ required, omit to launch GUI)
--prefix PREFIX         Filename prefix to strip (default: auto-detect project numbers)
--suffixes LIST         Comma-separated site suffixes to strip
-e, --extensions LIST   File extensions to include (blank = all)
--exclude PATTERNS      Comma-separated exclusion patterns (default: "*_log_*, test_*, EG-*.xml")
--include-logs          Include Logs folders (excluded by default)
--include-bak           Include .bak files (excluded by default)
--size-threshold N      Size difference threshold % (default: 10)
-o, --output PATH       Output CSV path (default: auto-named with timestamp)
--gui                   Force GUI mode
--version               Show version number

Filename Normalization

The tool handles CAD/engineering naming conventions where project files follow this pattern:

Convention Example Normalized
Template EXC3D.dwg EXC3D.dwg
Project prefix 25012218-EXC3D.dwg EXC3D.dwg
Project + site suffix 25012218-EXC3D_Anna.dwg EXC3D.dwg
Sub-project prefix 25012218.02-Base.dwg Base.dwg

This allows comparing a template folder against multiple site-specific project folders where every file has a different prefix and suffix but the same base name.

CSV Output

The exported CSV contains these sections:

Category Description
EXACT_MATCH Files with identical names across all folders
NORMALIZED_MATCH Files matching after normalization (different prefix/suffix)
MISSING Files present in some folders but not all
FUZZY_MATCH Probable matches for missing files (similarity score)
SIZE_MISMATCH Files matching by name but differing in size beyond threshold
CASE_MISMATCH Files where only letter case differs
DIR_DIFF Directory structure differences between folders
EMPTY_FOLDER Empty folders detected in each scan
SCAN_STATS Per-folder statistics (included, excluded, by reason)

Default Exclusions

By default, the following are excluded from comparison:

  • Logs folders — any folder named "Logs" and its contents
  • .bak files — backup files
  • Wildcard patterns*_log_*, test_*, EG-*.xml

These can be overridden via CLI flags (--include-logs, --include-bak) or customized in the GUI.

Project Structure

Folder_Comparing/
├── folder_compare.py   # Main script (v1.1.0)
├── test_smoke.py       # Smoke test suite
├── .gitignore
├── .gitattributes
├── LICENSE             # GPL-3.0
└── README.md

License

GPL-3.0 — see LICENSE.

About

A comparison tool designed to compare 2+ project folders to find missing files, extra files, and structural differences. The challenge it solves: files following naming conventions where a template file becomes a project file in a project folder (project number prefix + site name suffix). The tool normalizes these names to compare apples to apples.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages