A simple command-line tool to recursively delete unwanted system or metadata files (e.g., .DS_Store, Thumbs.db, ._*) from any directory. Built with Typer.
With pipx (recommended)
poetry install
poetry build
pipx install dist/clean_unwanted-0.1.0-py3-none-any.whlThen from anywhere, you can run:
clean-unwanted /path/to/dirpoetry installThen within the project directory, you can run the tool directly:
poetry run clean-unwanted /path/to/dirUsage: clean-unwanted [OPTIONS] DIRECTORY
Arguments:
DIRECTORY Target directory to clean. [default: .]
Options:
-p, --pattern TEXT File pattern(s) to remove (can use wildcards). [default: .DS_Store,Thumbs.db, .Spotlight-V100, desktop.ini, ._*]
-v, --verbose Print each matched file.
--dry-run Preview what will be deleted without removing anything.
--help Show this message and exit.Running the tool with just a directory will recursively remove these files:
.DS_StoreThumbs.db.Spotlight-V100desktop.ini._*(resource forks from macOS)
clean-unwanted /path/to/dirYou can override the default list using one or more --pattern (or -p) flags. These support glob-style wildcards (*, ?, etc.).
-
Remove
.bakand.tmpfiles:clean-unwanted . -p "*.bak" -p "*.tmp"
-
Match a specific file name:
clean-unwanted . -p ".DS_Store"
-
Match all hidden files:
clean-unwanted . -p ".*"
Note: Specifying
--patternreplaces the default list.
clean-unwanted %userprofile%/projects --dry-run --verbose -p "*.log" -p "Thumbs.db"This will preview the deletion of all .log files and Thumbs.db in the specified directory, showing each matched file without actually deleting anything.
MIT License.