Skip to content

randose/clean-unwanted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Clean Unwanted

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.


πŸš€ Installation

With pipx (recommended)

poetry install
poetry build
pipx install dist/clean_unwanted-0.1.0-py3-none-any.whl

Then from anywhere, you can run:

clean-unwanted /path/to/dir

From source with Poetry

poetry install

Then within the project directory, you can run the tool directly:

poetry run clean-unwanted /path/to/dir

Usage

Usage: 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.

🧼 Default Behavior

Running the tool with just a directory will recursively remove these files:

  • .DS_Store
  • Thumbs.db
  • .Spotlight-V100
  • desktop.ini
  • ._* (resource forks from macOS)
clean-unwanted /path/to/dir

🧩 Custom Patterns

You can override the default list using one or more --pattern (or -p) flags. These support glob-style wildcards (*, ?, etc.).

Examples:

  • Remove .bak and .tmp files:

    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 --pattern replaces the default list.


πŸ“‚ Example

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.


πŸ›  License

MIT License.

About

CLI tool to delete unwanted file types.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages