Last active
February 1, 2021 08:19
-
-
Save rodrigo-x/e83f66a28db109d429ca97c974362a01 to your computer and use it in GitHub Desktop.
Quebra-galho...
This file contains hidden or 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
#!/usr/bin/env bash | |
MoveImg () { | |
clear | |
read -p "Digite o diretório das imagens Ex: /home/seuusuario/Imagens/ : " directory | |
checkDir () { | |
if [ ! -d "$directory" ]; then | |
clear | |
sleep 1 | |
echo "Digite um diretório válido!" | |
exit 0 | |
fi | |
} | |
checkDir | |
clear | |
read -p "Digite a resolução que quer filtrar as imagens Ex: 768*1366: " resols | |
checkResolution () { | |
if [ ! $(echo "$resols" | grep "^[0-9]") ]; then | |
clear | |
sleep 1 | |
echo "Digite a resolução adequada com o * entre os números!" | |
exit 0 | |
fi | |
} | |
checkResolution | |
moveToDir () { | |
for images in "$directory"*.jpg; do | |
resolution=$(identify -format "%h*%w" $images | cut -d : -f 1) | |
if [[ "$resolution" == "$resols" ]]; then | |
$(mv $images $HOME) | |
fi | |
done | |
} | |
moveToDir | |
} | |
MoveImg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment