Skip to content

Instantly share code, notes, and snippets.

@halivert
Created November 25, 2018 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halivert/a14405d4c011c6d9ed8eefe963567c4a to your computer and use it in GitHub Desktop.
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
#! /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