Skip to content

Instantly share code, notes, and snippets.

@danim47c
Created November 23, 2020 16:13
Show Gist options
  • Save danim47c/222ea46fceaebd2bf8d3d08b4f36b5db to your computer and use it in GitHub Desktop.
Save danim47c/222ea46fceaebd2bf8d3d08b4f36b5db to your computer and use it in GitHub Desktop.
A command that converts all jpg and png images in a folder and subfolders into .webp
find ./ -type f -name '*.jpg' -exec sh -c 'cwebp -q 100 $1 -o "${1%.jpg}.webp"' _ {} \; && find ./ -type f -name '*.png' -exec sh -c 'cwebp -q 100 $1 -o "${1%.png}.webp"' _ {} \; && rm */**/*.jpg && rm */**/*.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment