Created
July 8, 2026 20:56
-
-
Save soykanozcelik/45b0c1ff48dfc3fac1b38b4c5d273e10 to your computer and use it in GitHub Desktop.
Remove Bin and Obj Folder
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 | |
| # Constrain the allowable path in which to execute the actions. | |
| # Assumes that your projects reside in ~/Projects | |
| constrainedPath="$HOME/Projects" | |
| if [ -z $1 ] ; then | |
| exit 1 | |
| elif [[ $1 != *$constrainedPath* ]]; then | |
| echo "Invalid path. The allowable path is constrained to $constrainedPath (and subdirectories) for safety" | |
| exit 1 | |
| else | |
| foldersToRemove=$(find $1 -type d \( -name bin -o -name obj \)) | |
| if [[ $foldersToRemove != "" ]]; then | |
| echo "Removing folders:" | |
| echo "$foldersToRemove" | |
| rm -rf `find $1 -type d \( -name bin -o -name obj \)` | |
| else | |
| echo "No bin or obj folders to remove" | |
| fi | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment