Created
December 17, 2013 12:49
-
-
Save u2/8004430 to your computer and use it in GitHub Desktop.
Shell遍历文件夹并删除匹配文件
This file contains 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/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment