Skip to content

Instantly share code, notes, and snippets.

@yvovandoorn
Created October 11, 2019 21:15
Show Gist options
  • Save yvovandoorn/ef967817ba791306f3d2e8f3a12b5c78 to your computer and use it in GitHub Desktop.
Save yvovandoorn/ef967817ba791306f3d2e8f3a12b5c78 to your computer and use it in GitHub Desktop.
#!/bin/bash
DEST="/Users/yvo/Desktop/logos2"
# Run this from devopsdays-web/static/events
for i in $(ls); do echo $i >> /tmp/cities; done
awk -F"-" '{ print $2}' /tmp/cities | sort | uniq > /tmp/stripped
for i in $(cat /tmp/stripped); do
for j in {2010..2020}; do
if [ -d $j-$i ]; then
if [ -f $j-$i/logo.png ]; then
cp -f $j-$i/logo.png $DEST/$i.png
else
if [ -f $j-$i/logo.jpg ]; then
cp -f $j-$i/logo.jpg $DEST/$i.jpg
if [ -f $DEST/$i.png ]; then
rm -f $DEST/$i.png
fi
fi
fi
else echo "file not found"
fi
done
done
rm -f /tmp/cities /tmp/stripped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment