Everything

I need a little tech help…

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:

  1. find the matching image
  2. cp /moblog /content/images/latest.jpg
  3. embed /content/images/latest.jpg in one of my posts
  4. execute steps 1 & 2 via cron

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

Leave a Reply