How to delete all bin/obj folders in a complex solution in GitBash
Sometimes we need to delete all the bin/obj folders in a solution to resolve issues in Rider or Visual Studio. I assume you already have your preferred method for this task, but I would like to share my approach here in case someone else is unaware of how to do it in GitBash or MSys terminal:
cat ~/bin/delBinObj
set -e
find . -iname "bin" -print0 | xargs -0 echo
find . -iname "obj" -print0 | xargs -0 echo
read -p "The above folders are going to be deleted, are you sure? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
find . -iname "bin" -print0 | xargs -0 rm -rfv
find . -iname "obj" -print0 | xargs -0 rm -rfv
echo done
else
echo no
exit 1
fi