遍历文件夹并删除DerivedData文件

#!/bin/bash

function getdir(){
    
    for element in `ls $1`
    do
         if [ -d $1"/"$element ];then
            if [[ ! "$element" == "DerivedData" ]];then
                getdir $1"/"$element

            else
                echo $1"/"$element >> /dev/ttys001
                rm -rf $1"/"$element

            fi
        fi

    done
}
root_dir="文件路径"
getdir $root_dir

创建.sh文件,并执行该文件./***.sh

你可能感兴趣的:(遍历文件夹并删除DerivedData文件)