Skip to content

Instantly share code, notes, and snippets.

@AquariusPower
Created May 15, 2017 08:10
Show Gist options
  • Save AquariusPower/871e5f81c5b2be700fe3d0c1dc120c91 to your computer and use it in GitHub Desktop.
Save AquariusPower/871e5f81c5b2be700fe3d0c1dc120c91 to your computer and use it in GitHub Desktop.
#!/bin/bash
strExt="png"
function FUNCconv() {
local lstrFile="$1"
lstrFileWebp="${lstrFile%.$strExt}.webp"
if [[ ! -f "$lstrFileWebp" ]];then
echo
echo ">>> working with $lstrFile <-> $lstrFileWebp"
cwebp -q 80 "$lstrFile" -o "$lstrFileWebp"
ls -l "$lstrFile" "$lstrFileWebp"
else
echo ">>> found $lstrFileWebp"
fi
};export -f FUNCconv
find ./ -iname "*.${strExt}" -exec bash -c "FUNCconv '{}'" \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment