function

Delete recursively all. Gradle,. Idea, and build directories in the specified directory

usage

CleanIdeaProject. // Clean up the current directoryCopy the code

Script content — cleanIdeaProject

#! /bin/bash
function cleanDir(){
    deleteDirectoryNameList="build .gradle .idea"
    for element in `ls -A The $1`
    do
        dir_or_file=The $1"/"$element
        if [ -d $dir_or_file ]
        then
            for directoryName in $deleteDirectoryNameList
            do
                if [ $directoryName = $element ] 
                then
                    echo "delele $dir_or_file"
                    rm -rf $dir_or_file
                    continue 2
                fi
            done
            cleanDir $dir_or_file
        fi
    done
}
cleanDir The $1
Copy the code

Running effect drawing