Skip to content

Instantly share code, notes, and snippets.

@thoinv
Created May 25, 2021 04:05
Show Gist options
  • Save thoinv/2945f22e8f23aaaa23f21c626dae4ffc to your computer and use it in GitHub Desktop.
Save thoinv/2945f22e8f23aaaa23f21c626dae4ffc to your computer and use it in GitHub Desktop.
[Keep only drawable folders in app resource] #macos #mod
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