Created
November 25, 2018 18:35
-
-
Save halivert/a14405d4c011c6d9ed8eefe963567c4a to your computer and use it in GitHub Desktop.
Script that converts pdf to jpg and copy the pdf to an usb
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/zsh | |
setopt +o nomatch | |
RED='\033[0;31m' | |
NC='\033[0m' | |
PDFinDownloads=$(ls ~/Descargas/Exhibidores*.pdf -t 2>/dev/null | head -1) | |
mv $PDFinDownloads . 2>/dev/null | |
if [ $? -ne 0 ]; then | |
echo "${RED}There's no Exhibidor files in Descargas" | |
fi | |
lastPDFFile=$(ls *.pdf -t | head -1) | |
convert -density 150 $lastPDFFile -quality 100 -background "#FFF" "Exhibidores siguiente semana.jpg" | |
if [ $? -eq 0 ]; then | |
echo "${NC}Created $lastPDFFile" | |
fi | |
cp $lastPDFFile /run/media/hali/JAJALI 2>/dev/null | |
if [ $? -eq 0 ]; then | |
echo "${NC}Copied $lastPDFFile" | |
else | |
echo "${RED}Can't copy $lastPDFFile" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment