How can I, using only command line tools, find the newest .jpg file in a given directory? I would like to use that in part of a cron job so I can copy images from my moblog to a common directory with my Word Press instillation.
- find the matching image
- cp /moblog /content/images/latest.jpg
- embed /content/images/latest.jpg in one of my posts
- execute steps 1 & 2 via cron
Anyone know how to pull this off?
The basic command is: mv `ls -tr | tail -1` ../hereitis.jpg
Here is the answer
cp `ls -tr | tail -1` /YOURFULLPATHHERE/moblog.jpg
convert /YOURFULLPATHHERE/moblog.jpg -resize 400×400 YOURFULLPATHHERE/moblog_resized.jpg