Skip to content

Instantly share code, notes, and snippets.

@kaushikgandhi
Created June 28, 2021 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaushikgandhi/99974fcf9e0ce19c36cef62cf255d906 to your computer and use it in GitHub Desktop.
Save kaushikgandhi/99974fcf9e0ce19c36cef62cf255d906 to your computer and use it in GitHub Desktop.
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
@kaushikgandhi
Copy link
Author

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