Hi unix people, i'm really a newbie and i've created a small bash to process some picture with ImageMagick.
I have just some issue and i think this script, if we can help me to correct in right way, could be useful!
Basically i have a Eyefi Card who puts files into a folder called "picture"
(sorry i must use cygwin cause last version EyeFi does'nt work under linux environemet)
i need take only the last 25 pictures from that,rename and put in a separate folder (i don't know how to do it so i put on same
)
after i process the dimension, add the watermark and copy on different folder.
here the code:
#!/bin/bash
while :
do
echo "Foto Su Eyefi build 1.9 del 28.07.2015 ---- Riccardo Galardi"
sleep 2s
echo "VAI ALLA CARTELLA PICTURES"
sleep 2s
cd /
cd cygdrive/c/PICTURES
echo "--------OK---------"
echo "Prendo gli ultimi 25 files e li sovrascrive nella stessa cartella PICTURES con numerazione progressiva"
sleep 2s
find $DIR -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2 | tail -n 25 | gawk 'BEGIN{ a=1 }{ printf "mv \"%s\" %04d.JPG\n", $0, a++ }' | bash
echo "--------OK---------"
sleep 2s
echo "Riduco le dimensioni a 1920 lato lungo"
mogrify -resize 1920x1920 *.jpg
sleep 2s
echo "--------OK---------"
echo "Inserisci il Logo sulle foto"
mogrify *.jpg -gravity center -draw "image over 0,0 0,0 'Back.png'" *.jpg
echo "--------OK---------"
sleep 2s
echo "Copia le foto elaborate sul drive Z"
cp *.JPG /cygdrive/z
echo "--------OK---------"
sleep 2s
echo "attendo 10 sec"
echo "Press [CTRL+C] to stop.."
sleep 10s
done
my biggest problem is: how i can exctract only the pictures and not the other files inside the folder? (often my watermark is taked as picture...and processed also if it's in a separate folder)
and how can i put only the last 25 files on a separate folder?
Thank you very much, really apreciate any help.... and hope my script could be interesting to someone else who use EyeFi card