cleanse - Remove bin/obj Folders
The cleanse command recursively removes all bin and obj folders from a directory tree. This is useful for cleaning up build artifacts, reducing disk space usage, and ensuring fresh builds. It’s particularly helpful when switching branches, troubleshooting build issues, or preparing a codebase for distribution.
nmbl cleanse [Path] [options]
Path- Root directory to clean (default: current directory)
-y- Skip confirmation prompt and delete immediately
Reports the number of folders deleted.
nmbl cleanse
Prompts for confirmation before deleting folders.
nmbl cleanse ~/projects/MySolution -y
Immediately deletes all bin/obj folders under the specified path.
# Clean before branch switch
nmbl cleanse -y
# Switch branches
git checkout feature-branch
# Do a clean build
dotnet build
nmbl cleanse ~/projects/Solution1 -y
nmbl cleanse ~/projects/Solution2 -y
nmbl cleanse ~/projects/Solution3 -y
# Clean all build artifacts
nmbl cleanse -y
# Rebuild from scratch
dotnet clean
dotnet restore
dotnet build
Build issues sometimes stem from stale artifacts. A full cleanse ensures a fresh start.
# See how much space you're using
du -sh ~/projects
# Clean all solutions
nmbl cleanse ~/projects -y
# Check space savings
du -sh ~/projects
Build artifacts can consume significant disk space, especially in large solutions.
# Before committing or switching branches
nmbl cleanse -y
# Ensures build artifacts aren't accidentally committed
git status
# In a build script
nmbl cleanse /build/source -y
dotnet restore
dotnet build
dotnet test
Start CI builds with a clean slate.
# Clean up your workspace
nmbl cleanse ~/workspace -y
Free up disk space and ensure tomorrow’s builds are fresh.
The command removes:
- All
binfolders and their contents - All
objfolders and their contents - These folders are recursively found in the entire directory tree
- Confirmation prompt - By default, asks for confirmation before deletion
- Selective deletion - Only removes
binandobjfolders, nothing else - Progress reporting - Shows how many folders were deleted
# Add to your shell profile
alias clean='nmbl cleanse -y'
# Use it
clean
# Remove build artifacts
nmbl cleanse -y
# Remove untracked files
git clean -fdx -e .vs -e .vscode
Complete cleanup including git ignored files.
# Add to cron or scheduled task
nmbl cleanse ~/projects -y
Automatically clean up build artifacts weekly.
endregions- Remove region directivesgitupdate- Update git repositories