Skip to content

Instantly share code, notes, and snippets.

@fedemkr
Created April 9, 2019 17:02
Show Gist options
  • Save fedemkr/da1a1a84abe80c5be0eed56d71adb575 to your computer and use it in GitHub Desktop.
Save fedemkr/da1a1a84abe80c5be0eed56d71adb575 to your computer and use it in GitHub Desktop.
Mac Automator script to delete all nuget packages in $Home/.nuget/packages and also the bin & obj folders of a C# solution
#!/bin/bash
nugetPackagesFolder="$HOME/.nuget/packages"
rm -r `find $nugetPackagesFolder -type d -not -path $nugetPackagesFolder
`
constrainedPath="$HOME/Documents"
if [ -z $1 ] ; then
exit 1
elif [[ $1 != *$constrainedPath* ]]; then
exit 1
else
foldersToRemove=$(find $1 -type d \( -name bin -o -name obj \))
if [[ $foldersToRemove != "" ]]; then
rm -rf `find $1 -type d \( -name bin -o -name obj \)`
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment