Like dotnet clean but more thorough.
scrub
is especially useful if you are switching between developing on
Windows and WSL frequently, and you want to quickly clean out any left-over
build artifacts or intermediate files. The difference between scrub
and
dotnet clean
is that scrub
removes the bin
or obj
folders completely,
not just the build artifacts created by MSBuild
.
Install scrub
globally with
dotnet tool install --global scrub
Simply run scrub
in any folder you want to clean out. It will recursively
traverse any folder and remove all bin
and obj
folders it encounters.
bjorn:/mnt/c/src/scrub$ scrub
Should I remove '/mnt/c/src/scrub/bin'? y/n
y
Removing '/mnt/c/src/scrub/bin'
Should I remove '/mnt/c/src/scrub/obj'? y/n
y
Removing '/mnt/c/src/scrub/obj'
You can skip user interaction by running scrub
with --ask false
:
bjorn:/mnt/c/src/scrub$ scrub --ask false
Removing '/mnt/c/src/scrub/bin'
Removing '/mnt/c/src/scrub/obj'
You can also point it to where it should scrub await folders with --path
bjorn:/mnt/c/src$ scrub --path scrub/ --ask false
Removing '/mnt/c/src/scrub/bin'
Removing '/mnt/c/src/scrub/obj'
If you only want to list out bin
and obj
folders that scrub
finds, run it
with the --list
flag:
bjorn:/mnt/c/src/scrub$ scrub --list
'/mnt/c/src/scrub/bin'
'/mnt/c/src/scrub/obj'