Skip to content

Instantly share code, notes, and snippets.

@davidortinau
Created May 5, 2016 17:20
Show Gist options
  • Save davidortinau/e127aea1f287ba99478896fd58189e0c to your computer and use it in GitHub Desktop.
Save davidortinau/e127aea1f287ba99478896fd58189e0c to your computer and use it in GitHub Desktop.
Shell script to take Android assets exported from Sketch and sort them into resource folders. Adapted from https://medium.com/@lmindler/using-sketch-3-and-a-bit-of-fairy-dust-for-a-better-android-workflow-f667d0048855#.r8qyblpe7.
mkdir drawable-xxhdpi; mkdir drawable-xhdpi; mkdir drawable-hdpi; mkdir drawable-mdpi
for file in $(find . -type f -iname '*-xxhdpi*'); do
mv "$file" "drawable-xxhdpi/${file/-xxhdpi/}"
done
for file in $(find . -type f -iname '*-xhdpi*'); do
mv "$file" "drawable-xhdpi/${file/-xhdpi/}"
done
for file in $(find . -type f -iname '*-hdpi*'); do
mv "$file" "drawable-hdpi/${file/-hdpi/}"
done
for file in $(find . -type f -iname '*-mdpi*'); do
mv "$file" "drawable-mdpi/${file/-mdpi/}"
done
@davidortinau
Copy link
Author

To make the shell script executable:
sudo chmod +x SortDroidAssets.sh

I add the file to my PATH so I can use it anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment