Skip to content

Instantly share code, notes, and snippets.

@mzfshark
Last active March 18, 2020 17:28
Show Gist options
  • Save mzfshark/fa8f74f87ffb319e79a2813f3f6e4b8e to your computer and use it in GitHub Desktop.
Save mzfshark/fa8f74f87ffb319e79a2813f3f6e4b8e to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ -z $1 ]]; then
echo "Informe um caminho... Ex: resize /home/user_url"
else
# Renomeando todos os arquivos [JPG jpeg gif png] para jpg
find $1 -type f \( -name \*.JPG -o -iname \*.jpeg -o -iname \*.gif -o -iname \*.png \) | xargs -n 1 bash -c 'mv "$0" "${0%.*}.jpg"'
# Convertendo todas as imagens para 600 px
find $1 -type f -name \*.jpg | xargs -L1 -I{} convert -resize 600 "{}" "{}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment