Last active
March 2, 2016 00:32
-
-
Save marlosirapuan/81858bee98fad434ca01 to your computer and use it in GitHub Desktop.
converte arquivos *.jpg das pastas em .pdf
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
#!/bin/bash | |
### instala imagemagik | |
# brew install imagemagick | |
# convert *.jpg output.pdf | |
### dentro da pasta | |
# sh twd_convert.sh . | |
execute_convert() { | |
for i in "$1"/*;do | |
if [ -d "$i" ];then | |
echo "dir: $i" | |
cd $i > /dev/null | |
DIR_NAME=${PWD##*/} | |
echo "dirname: $DIR_NAME" | |
convert *.jpg TWD-$DIR_NAME.pdf | |
cd - > /dev/null | |
elif [ -f "$i" ]; then | |
echo "arq: $i" | |
fi | |
done | |
} | |
path="" | |
if [ -d "$1" ]; then | |
path=$1; | |
else | |
path="./" | |
fi | |
echo "base: $path" | |
#output_path="$path/output" | |
#mkdir -p $output_path | |
execute_convert $path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment