scripts/jpg_to_webp.sh
(Deskargatu)#!/bin/bash
find . -name "*.jpg" | while read file
do
NEWNAME=${file/.jpg/.webp}
if [ -f "$NEWNAME" ]
then
echo "ALREADY EXISTING! $NEWNAME"
rm "$file"
else
echo "Converting $file to $NEWNAME"
sem -j 10 --semaphorename jpeg2webp '(cwebp -quiet "'$file'" -o "'$NEWNAME'" && rm "'$file'")'
fi
done
echo "Script done."