Created
May 25, 2021 04:05
-
-
Save thoinv/2945f22e8f23aaaa23f21c626dae4ffc to your computer and use it in GitHub Desktop.
[Keep only drawable folders in app resource] #macos #mod
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
DIR="$( cd "$( dirname "$0" )" && pwd )" | |
for entry in "$DIR"/* | |
do | |
if [[ "$entry" != *"/drawable"* ]] && [[ "$entry" == *"/resource-designer/res/"* ]] | |
then | |
#remove all folder != drawable* | |
rm -rf "$entry" | |
else | |
# remove all file xml | |
for file in "$entry"/* | |
do | |
if [[ "$file" == *.xml ]] || [[ "$file" == *"/abc_"* ]] || [[ "$file" == *".9.png" ]] | |
then | |
rm -rf "$file" | |
fi | |
done | |
fi | |
done | |
echo "---> Remove unrelated files and folders successfully" | |
for entry in "$DIR"/* | |
do | |
DIRCOUNT=$(ls "$entry" |wc -l) | |
if [ $DIRCOUNT -eq 0 ]; then | |
rm -rf "$entry" | |
fi | |
done | |
echo "---> Remove empty folders successfully" | |
echo "Successfully" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment