Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Shell command One liner for converting all images in a directory to webp format
for i in *;do inpt="$i"; arrIN=(${inpt//./ }); convert $i ./webp/${arrIN[0]}.webp;done
#convert command comes in handy if you have imagemagick and webp installed or else run
#sudo apt-get install webp imagemagick
Copy link

kaushikgandhi commented Jun 29, 2021

j=0; for i in *;do inpt="$i"; (( j++ )); if [ $j -gt 15994 ]; then echo "$i"; fi; done

if it somehow breaks, in my case the loop was terminated after executing 15994 files.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment