link > ultimate.lua - v4.4 beta release
Adds a user param for "Delete oldest if card full?"
If you enable this parameter, it stores the current image number and DCIM folder of the first image taken. When the SD card is full, it deletes that image and the next three taken by incrementing the image number (and DCIM folder number if necessary). This process repeats as shooting continues and space is needed.
This somewhat simplistic algorithm depends on the camera incrementing image names sequentially (i.e. IMG_1001.JPG to IMG_10002.JPG) and using sequential folders in the DCIM folder ( i.e. A/DCIM/103CANON to A/DCIM/104CANON) . Most Canon P&S cameras do this by default but if yours has options please configure them this way.
The advantage of this approach is that it will only delete images taken during the current intervalometer shooting sequence. So your family vacation snap shots and other images are safe.
The algorithm should work well with large SD cards and tens of thousands of images saved in long time lapse sessions as it does not make any attempt to read and sort all images by creation date / time.
The drawback to this approach is that if you start with a mostly full card (i.e. forget to delete images from previous shooting sessions) you will only get few new images before the oldest ones in the current session start getting deleted.
With that warning, I think this is a good way to go. Please try it and report - I've used the script's debug mode and a small SD card to test. It will be interesting to see what a long run in real time looks like. Please post the log file if possible.