delete oldest images from remote server

Would someone please give me a script that will remove all but the newest jpg image from my server.
i am uploading a new image every 10 seconds form a live web cam
Also i do not know who to make a shell script work
i am new to all this so i need all the help you could give
Thank You very much

You can do something like:

ls -1tr *.jpg |sed '$d'|xargs rm -f

but try this first to be sure you get the desired files:

ls -1tr *.jpg |sed '$d'|xargs ls -l

Regards