System cleanup and file management toolbox
Project description
Inspectomat Toolbox
This toolbox folder contains a set of simple, interactive utilities for cleaning up files and directories on your computer. Each tool is a separate Python script, launched from a central menu.
How to run?
- Go to the toolbox directory:
cd toolbox
- Activate your virtual environment (if needed):
source ../venv/bin/activate
- Start the menu:
python menu.py
Installation
To install the inspectomat package and make it available as a command-line tool, run:
# Install in development mode
pip install -e .
This will install the inspectomat command in your system.
Usage
After installation, you can use the inspectomat tool in three ways:
Interactive Shell
Simply run the inspectomat command without arguments to start the interactive shell:
inspectomat
# or explicitly
inspectomat -i
This will show a prompt where you can type commands. Use list to see all available commands:
inspectomat> list
Direct Command Execution
You can run specific commands directly:
inspectomat cleanemptydirs
inspectomat findbigfiles
inspectomat comparefolders
# etc.
Use inspectomat -l or inspectomat --list to see all available commands.
Scriptable Shell Interface
You can also use the scriptable shell interface to call specific functions with parameters:
# List all available commands
inspectomat -l
# Call a specific function in a module
inspectomat cleanemptydirs -f find_empty_dirs -p /path/to/directory
# Call with named parameters
inspectomat findbigfiles -f find_big_files -p min_size=1000000 dir_path=/home/user/Documents
Command line arguments:
-f, --function: Function to call within the module-p, --params: Parameters for the function (space-separated, use key=value format for named parameters)-i, --interactive: Start interactive shell-l, --list: List available commands-y, --yes: Automatically answer yes to all prompts--repair: Check and repair dependencies
Dependency Management and Self-Repair
The inspectomat package includes a self-repair mechanism that can automatically detect and install missing dependencies. If a command fails due to a missing dependency, the system will offer to install it for you.
To manually check and install dependencies:
# Interactive mode (will ask for confirmation)
inspectomat repair
# Non-interactive mode (automatically installs dependencies)
inspectomat repair -y
In the interactive shell, you can use the repair command:
inspectomat> repair
The system will automatically detect the following types of dependencies:
- Core dependencies required for basic functionality
- Optional dependencies required for specific modules
If you want to install all optional dependencies at once:
pip install -e .[full]
Development
Running Tests
The package includes unit tests to ensure functionality works as expected. To run the tests:
# Run all tests
python run_tests.py
# Run tests with unittest directly
python -m unittest discover tests
# Run a specific test
python -m unittest tests.test_cli
Project Structure
inspectomat/
├── inspectomat/ # Package directory
│ ├── __init__.py # Package initialization
│ ├── cli.py # Command-line interface
│ ├── clean_empty_dirs.py # Utility modules
│ ├── ...
├── tests/ # Test directory
│ ├── __init__.py
│ ├── test_cli.py # Tests for CLI
│ ├── test_clean_empty_dirs.py # Tests for utilities
├── setup.py # Package setup file
├── run_tests.py # Test runner script
├── README.md # This file
└── LICENSE # License file
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Tools Overview
- compare_equal_folders.py – Compare contents of folders up to a chosen depth, log equal folders, and show progress.
- git_projects_audit.py – Audit local git projects, check remote existence and equality, log results.
- clean_empty_dirs.py – Remove empty directories recursively.
- find_big_files.py – Find and list the largest files in a directory tree.
- batch_compare_folders.py – Batch compare multiple folders and show results.
- move_batch_duplicates.py – Move detected duplicate folders/files in batch mode.
- resolve_folder_differences.py – Powerful, interactive N-way folder comparison and resolution tool (see below).
- find_similar_projects.py – Wyszukuje w wybranej lokalizacji grupy folderów-projektów o podobnej strukturze (np. pliki, podfoldery). Wynik: gotowe grupy ścieżek do porównania narzędziem resolve_folder_differences.py. Przy każdym folderze pokazuje liczbę plików (rekurencyjnie) i całkowity rozmiar.
resolve_folder_differences.py
Interaktywny skrypt do porównywania podfolderów (do wybranej głębokości) w wielu katalogach bazowych. Pozwala szybko wykryć i rozwiązać różnice w strukturze projektów, nawet dla dużych zbiorów.
Najważniejsze funkcje:
- Porównanie N folderów naraz – Wprowadź dowolną liczbę ścieżek do katalogów do porównania.
- Dogłębna analiza – Porównuje wszystkie pliki w podfolderach (do wybranej głębokości), wykrywa brakujące i różniące się pliki.
- Tabela różnic – Przejrzysta, szeroka tabela z pełnymi ścieżkami folderów i datami modyfikacji plików (najstarsze/nowe podświetlone kolorami). Wyświetlane są tylko pliki, które się różnią.
- Interaktywne menu – Dla każdej grupy różniących się podfolderów możesz: usunąć wybrany folder, przenieść wybrany folder do subfolderu
differentw innym i usunąć oryginał, pominąć lub zakończyć. - Obsługa .ignore – Plik
.ignore(tworzony automatycznie) pozwala wykluczyć z porównań katalogi i pliki (np..git,.idea,venv). - Kolorowy, czytelny interfejs – Kolory dla nagłówków, dat, menu, paska postępu.
- Pasek postępu – Wskazuje postęp skanowania i porównywania.
- Informacja o braku różnic – Czytelny komunikat, jeśli nie znaleziono żadnych różnic.
- Dowolna głębokość skanowania – Na starcie wybierasz głębokość (domyślnie 2).
Szybki start
-
Dodaj katalogi do porównania:
python resolve_folder_differences.pyPodaj ścieżki do katalogów, zakończ pustą linią. Zostaniesz zapytany o głębokość skanowania.
-
Dostosuj wykluczenia: Edytuj plik
.ignorew katalogu toolbox, aby wykluczyć nieistotne katalogi/pliki. -
Postępuj zgodnie z menu: Skrypt wyświetli różnice i zapyta o akcję dla każdej grupy podfolderów.
Przykład wykluczania
Plik .ignore (domyślnie tworzony z wpisem .git):
.git
.idea
venv
*.log
Wymagania
- Python 3.7+
- Terminal obsługujący kolory ANSI
Autor
Tom Sapletta
find_similar_projects.py
Ten skrypt pozwala automatycznie odnaleźć podobne projekty w dużej strukturze katalogów. Ułatwia szybkie przygotowanie listy ścieżek do dalszego porównania.
Funkcje:
- Wskazujesz ścieżkę startową oraz głębokość penetracji (domyślnie 2).
- Skrypt wyszukuje foldery, które wyglądają jak projekty (np. zawierają setup.py, .git, package.json, itp.).
- Grupuje projekty o bardzo podobnej strukturze plików i folderów.
- Dla każdej ścieżki pokazuje liczbę plików (rekurencyjnie) oraz rozmiar całkowity folderu.
- Wynikiem są grupy ścieżek, które możesz podać do resolve_folder_differences.py.
Przykład użycia
python find_similar_projects.py
Enter root path to search for projects: /home/tom/Projects
How deep should be scanned? (default 2): 2
Groups of similar projects:
Group 1:
/home/tom/Projects/app1 files: 123 size: 12.3 MB
/home/tom/Projects/app2 files: 121 size: 12.2 MB
You can use the above paths as input to resolve_folder_differences.py for comparison.
Wskazówki
- Im większa głębokość, tym więcej potencjalnych projektów zostanie znalezionych (ale wolniej).
- Możesz edytować plik .ignore, aby wykluczyć katalogi typu .git, .idea, node_modules itd.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file inspectomat-0.1.5.tar.gz.
File metadata
- Download URL: inspectomat-0.1.5.tar.gz
- Upload date:
- Size: 38.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
933e7c31da523338fb567ae149e5dd6b827467abc449339fb67cff8def13c7e0
|
|
| MD5 |
a0e3bce310eaf20899b6c4c7065b6742
|
|
| BLAKE2b-256 |
25fe0210810c52be8be76b41f88c04c43eeb6a7b13ffc8c370c354ab819f8d82
|
File details
Details for the file inspectomat-0.1.5-py3-none-any.whl.
File metadata
- Download URL: inspectomat-0.1.5-py3-none-any.whl
- Upload date:
- Size: 43.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84a2cbc45bcb92ed1f21e6a840871ca8ff21c0552178d9e952ef8ad8a20f3b37
|
|
| MD5 |
c46bfe5ae2393c4d017d73a611732eef
|
|
| BLAKE2b-256 |
3ea51a84a3931438ac4a12f7f57921c89ff589de3167625d5bb0a7bd6d10fcd0
|