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.
Basically:
Anyone know how to pull this off?
EDIT:
The basic command is: mv `ls -tr | tail -1` ../hereitis.jpg
EDIT2:
Here is the answer
curl http://www.ineedcaffeine.com/moblog/SCRIPT.php
cd /YOURFULLPATHHERE/moblog/images
cp `ls -tr | tail -1` /YOURFULLPATHHERE/moblog.jpg
convert /YOURFULLPATHHERE/moblog.jpg -resize 400×400 YOURFULLPATHHERE/moblog_resized.jpg