A command-line tool for safely cleaning files and directories using customizable rules and dry-run preview
Project description
CLI Cleaner
A command-line tool for safely cleaning files and directories in your project.
By default, it runs in dry-run mode: it only shows what would be deleted. Add --delete to actually remove files.
- Beautiful output powered by rich
- Flexible cleanup rules with
--dirs,--files,--globs - Built-in presets for popular stacks: Python, Node, Rust, Go, Java, and more
- Custom presets from
pyproject.tomlorcleanerconfig.toml - Dedicated subcommands for cleanup and preset management
Commands:
cleaner clean ...
cleaner presets list
cleaner presets export <name>
Requires Python ≥ 3.12.
Installation
pipx install cli-cleaner
Or:
pip install cli-cleaner
Quick start
Dry run:
cleaner clean -d __pycache__ -d .pytest_cache -g "build/**" -f "notes.temp.txt"
Real deletion:
cleaner clean -d __pycache__ -d .pytest_cache -g "build/**" -f "notes.temp.txt" --delete
Examples:
cleaner clean -g "**/*.pyc" -d __pycache__
cleaner clean -g "build/**" -g "dist/**" --delete
cleaner clean -f stray.log -f notes.temp.txt --ignore-dirs ".venv" --ignore-files stray.log --delete
Commands
cleaner clean
Main cleanup command.
cleaner clean [OPTIONS]
Supported options:
--dirs,-d— directory names to delete--files,-f— file names to delete--globs,-g— glob patterns to delete--ignore-dirs,-id— directories to ignore--ignore-files,-if— files to ignore--root,-r— root directory for cleanup--use,-u— preset name--config— explicit path to a TOML config file with presets--delete— actually delete files instead of dry-run
Examples:
cleaner clean --use python
cleaner clean --use python --delete
cleaner clean -g "*.log" -d build --delete
cleaner presets list
Show all available presets, including built-in ones and presets loaded from config files.
cleaner presets list
With custom config:
cleaner presets list --config "./ops/cleanerconfig.toml"
cleaner presets export
Export a preset into a separate TOML file named {preset_name}_exported.toml.
cleaner presets export python
With custom config:
cleaner presets export frontend --config "./ops/cleanerconfig.toml"
Presets
List all presets:
cleaner presets list
Export a preset:
cleaner presets export python
Use a preset:
cleaner clean --use python
cleaner clean --use python --delete
cleaner clean --use node -g "*.log" --ignore-dirs ".vscode" --delete
Built-in presets
Built-in presets are stored in src/cli_cleaner/presets.toml.
Available out of the box:
python—__pycache__,.pytest_cache,.mypy_cache,.ruff_cache,.tox,.nox,.hypothesis,htmlcov,build,dist,.pytype,.pyre,*.pyc,*.pyo,*$py.class,**/*.egg-info/**,.coverage.*,pytest-*.xml,pytest-*.lognode—node_modules,.parcel-cache,.next,.nuxt,.svelte-kit,.vite,.turbo,.cache,coverage,dist,build,out,*.log,*.tsbuildinforust—target,coveragego—bin,build,dist,coverage,coverage.outjava—target,build,out,.gradle,.idea/modules, compiled.class,.jar,.war,.earartifactsdotnet—bin,obj,.vs,TestResults,artifacts,coveragephp—vendor,var/cache,var/log,storage/framework/cache,bootstrap/cache,coverage,build,dist,*.logruby—vendor/bundle,.bundle,coverage,tmp,pkg,log/*.logswift—DerivedData,.build,.swiftpm,build, Xcode user dataandroid—build,.gradle,app/build,.cxx,captures,coveragelatex— common intermediate files like*.aux,*.bbl,*.log,*.toc,*.out,*.synctex.gzhaskell—dist,dist-newstyle,.stack-work,coverageelixir—_build,deps,coveransible—*.retryc_cpp—build,bin,obj,.cache,CMakeFiles,Debug,Release,x64,x86, common binary/object artifactsunity—Library,Temp,Build,Logs,Objunreal—Binaries,DerivedDataCache,Intermediate,Saved/Logsos—.DS_Store,Thumbs.db,desktop.ini
Many presets also include default ignored directories such as .git, .hg, .svn, .idea, .vscode, venv, and .venv.
Project configuration
CLI Cleaner searches upward from the current working directory for:
pyproject.tomlcleanerconfig.toml
Preset merge order from lowest to highest priority:
- Built-in presets
pyproject.tomlcleanerconfig.toml- File passed explicitly via
--config
If the same preset name appears multiple times, the last source wins.
Example: pyproject.toml
[tool.cleaner.presets.my_python]
dirs = ["__pycache__", ".pytest_cache", "build", "dist"]
files = [".coverage", "coverage.xml"]
globs = ["**/*.pyc", "**/*.pyo", "**/*.egg-info/**"]
ignored_dirs = [".git", ".idea", ".vscode", ".venv"]
ignored_files = []
Example: cleanerconfig.toml
[tool.cleaner.presets.frontend]
dirs = ["node_modules", ".next", ".turbo", "dist", "build"]
files = [".eslintcache"]
globs = ["*.log", "*.tsbuildinfo"]
ignored_dirs = [".git", ".idea", ".vscode"]
ignored_files = []
Explicit config path
cleaner clean --use frontend --config "./ops/cleanerconfig.toml"
You can also use the same config file for preset inspection and export:
cleaner presets list --config "./ops/cleanerconfig.toml"
cleaner presets export frontend --config "./ops/cleanerconfig.toml"
Behavior
- Default mode is dry-run
- Add
--deleteto actually remove files cleaner cleanwithout arguments shows command help- To run cleanup, provide at least one selector:
--dirs--files--globs- or use a preset with
--use
- Manual CLI flags override preset values
- Many presets include ignored directories for safety, such as
.git,.idea,.vscode,venv,.venv
Typical scenarios
cleaner clean --use python
cleaner clean --use python --delete
cleaner clean --use node -g "*.log" --delete
cleaner clean -g "build/**" -g "*.temp.*" --ignore-dirs ".venv" --delete
cleaner clean --use frontend --delete
cleaner presets list --config "./ops/cleanerconfig.toml"
cleaner presets export python
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 cli_cleaner-1.3.tar.gz.
File metadata
- Download URL: cli_cleaner-1.3.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb8e3961ede5288fcd8b749f65375c0d28cd859e04be8d2060f29d35e712ef9b
|
|
| MD5 |
9331fd79b59fffcff8b14a9dae20ed87
|
|
| BLAKE2b-256 |
a3b2b678274c3fb845b29810e1700bc499bc1d680acb0109a85712ad9ed54002
|
Provenance
The following attestation bundles were made for cli_cleaner-1.3.tar.gz:
Publisher:
publish.yml on DasKaroWow/cli_cleaner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cli_cleaner-1.3.tar.gz -
Subject digest:
fb8e3961ede5288fcd8b749f65375c0d28cd859e04be8d2060f29d35e712ef9b - Sigstore transparency entry: 1220090755
- Sigstore integration time:
-
Permalink:
DasKaroWow/cli_cleaner@05ba81c466003965617f8d93c7fa8832de60d84f -
Branch / Tag:
refs/tags/v1.3 - Owner: https://github.com/DasKaroWow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@05ba81c466003965617f8d93c7fa8832de60d84f -
Trigger Event:
push
-
Statement type:
File details
Details for the file cli_cleaner-1.3-py3-none-any.whl.
File metadata
- Download URL: cli_cleaner-1.3-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b33e97ea48550d264d6d12c5ff932d48dbe53e7652fec2dc754aa239ec0c4fc
|
|
| MD5 |
52b2eb949b0a31bf4d54aa7bc1af0b83
|
|
| BLAKE2b-256 |
dff918d359db06ee091f2a050c5fe4c7689f8ca1713d7e782ee94cbb08160225
|
Provenance
The following attestation bundles were made for cli_cleaner-1.3-py3-none-any.whl:
Publisher:
publish.yml on DasKaroWow/cli_cleaner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cli_cleaner-1.3-py3-none-any.whl -
Subject digest:
5b33e97ea48550d264d6d12c5ff932d48dbe53e7652fec2dc754aa239ec0c4fc - Sigstore transparency entry: 1220090778
- Sigstore integration time:
-
Permalink:
DasKaroWow/cli_cleaner@05ba81c466003965617f8d93c7fa8832de60d84f -
Branch / Tag:
refs/tags/v1.3 - Owner: https://github.com/DasKaroWow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@05ba81c466003965617f8d93c7fa8832de60d84f -
Trigger Event:
push
-
Statement type: