Created
August 18, 2016 21:11
-
-
Save Prozi/255d24d8d849d2adcd512ac3b3626ad0 to your computer and use it in GitHub Desktop.
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 | |
# resize files downscale 50% when bigger than 800kb - run until happy or from cron | |
find . -size 0 -print0 | xargs -0 rm | |
minimumsize=800000 | |
for i in * ; do | |
actualsize=$(wc -c < "$i") | |
echo "parsing file $i" | |
if [ $actualsize -ge $minimumsize ]; then | |
convert "$i" -resize 50% "$i" | |
echo "ok" | |
else | |
echo "size is $actualsize = under $minimumsize bytes" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment