源码
#!/bin/bash
number=0
function listFiles()
{
for file in `ls $1`;
do
if [ -d "$1/$file" ]
then
if [[ "$file" == "test" ]]
then
echo "$1/$file"
((number++))
rm -rf $1/$file
continue;
fi
listFiles "$1/$file"
fi
done
}
listFiles $1
echo "test number = $number,has already delete!"
使用方法
# 注意documentName最后不能有/
$ bash test.sh documentName