[SOLVED] Simple script for converting to images to webp - how to avoid double file extension?
by Grobe from LinuxQuestions.org on (#4T8TV)
Hi.
I have made a simple but working sh script for converting png images to webp images using the cwebp command, because afaik the webp command itself can only handle one file at a time.
Code:#!/bin/bash
for i in *.png
do
echo ""
cwebp -z 9 "$i" -o "$i.webp"
# Make new file have same file-changed datestamp
touch -cm --reference="$i" "$i.webp"
echo ""
doneThis works very good, but every output file have this double file extension, for example "01.png" would be converted into "01.png.webp".
Do you guys have a neat way to solve this ?


I have made a simple but working sh script for converting png images to webp images using the cwebp command, because afaik the webp command itself can only handle one file at a time.
Code:#!/bin/bash
for i in *.png
do
echo ""
cwebp -z 9 "$i" -o "$i.webp"
# Make new file have same file-changed datestamp
touch -cm --reference="$i" "$i.webp"
echo ""
doneThis works very good, but every output file have this double file extension, for example "01.png" would be converted into "01.png.webp".
Do you guys have a neat way to solve this ?