Last active
March 11, 2022 20:32
-
-
Save johnrobertmcc/fbb6d4e2cba7803eaf629013e1dfe84c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ctwp() { | |
extension=$1 # take the extension you provided the function | |
for i in *.$extension # iterate through the files in the directory based on the extension | |
do | |
file=$i # declare the file as an easy-to-read variable | |
convert $file ${file%.*}.webp | |
# The above line: | |
#a) executes the ImageMagick command, and | |
#b) removes the basename from the file to grab only the file name | |
#(so ‘bull.jpg’ becomes ‘bull’) | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment