Shell遍历文件夹删除匹配文件
程序员文章站
2022-06-04 12:18:36
...
#!/bin/sh list_alldir(){ for file2 in `ls -a $1` do if [ x"$file2" != x"." -a x"$file2" != x".." ];then if [ -d "$1/$file2" ] && (echo $file2 | grep -qv '.svn');then list_alldir "$1/$file2" elif (echo $1/$file2 | egrep -q '(de|el|fr|it)\.yml$');then echo "$1/$file2" rm $1/$file2 fi fi done } list_alldir $1