Last active
March 7, 2016 21:41
-
-
Save eefret/8681652fb037b7b5a566 to your computer and use it in GitHub Desktop.
Sometimes in Android development you find designers that make your assets names with "-" this makes the android compiler to fail as assets cannot have "-", I create this script to solve this problem recursively renaming the files and replacing "-" with "_" plus making them lowercase.
This file contains hidden or 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/bash | |
# Normalize assets | |
# Sometimes in Android development you find designers that make your assets names with "-" this makes | |
# the android compiler to fail as assets cannot have "-", I create this script to solve this problem | |
# recursively renaming the files and replacing "-" with "_" plus making them lowercase. | |
# | |
# Instructions: | |
# 1- Move this script to your Android {PROJECT_BASE_FOLDER}/app/src/main/res | |
# 2- run it with sudo ex: "sudo ./rename_script.sh" | |
for f in drawable-*/*; do | |
MYDIR=$(dirname $f) # Obtaining dirname | |
MYFILE=$(basename $f) # Obtaining filename | |
SUB=`echo $MYFILE | sed 's/-/_/g' | tr [:upper:] [:lower:]` # Replacing "-" in filename for "_" plus making lowercase | |
echo "Moving File $MYDIR/$MYFILE -> $MYDIR/$SUB" #printing info to double check | |
mv $MYDIR/$MYFILE $MYDIR/$SUB #moving old file to new file (need sudo) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment