-
-
Save rtrouton/5f781c1cbeed1666121b to your computer and use it in GitHub Desktop.
This script is designed to mine /Applications and /System/Library on OS X to copy all available icon files to one location.
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/bash | |
# Create a /tmp/icons.XXXX directory to | |
# store the copied images and icon files | |
TMPDIR=`/usr/bin/mktemp -d /tmp/icons.XXXX` | |
# The function below uses the image file | |
# format specified by the "filetype" variable | |
# to copy the relevant image and icon files | |
# from /Applications and /System/Library | |
GetIcons () { | |
mkdir "$TMPDIR"/"$filetype" | |
mkdir "$TMPDIR"/"$filetype"/Applications | |
mkdir "$TMPDIR"/"$filetype"/System | |
echo "Copying $filetype files to $TMPDIR/$filetype" | |
find /Applications 2>/dev/null -iname "*.$filetype" -type f -print0 | xargs -0 -I '{}' cp "{}" $TMPDIR/$filetype/Applications 2>/dev/null | |
find /System/Library 2>/dev/null -iname "*.$filetype" -type f -print0 | xargs -0 -I '{}' cp "{}" $TMPDIR/$filetype/System 2>/dev/null | |
} | |
filetype="icns" | |
GetIcons | |
filetype="png" | |
GetIcons | |
filetype="pdf" | |
GetIcons | |
echo "All finished! Copied images and icon files are available in $TMPDIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment