Created
          April 9, 2019 17:02 
        
      - 
      
- 
        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
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/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