Capture an image every 2 seconds and keep the last 43,200 images (24 hours).
startuvc.sh
#!/bin/sh cd /home/pi/uvccapture uvccapture -v -S45 -B190 -C35 -G50 -x640 -y480 -t2 -c/home/pi/uvccapture/copyimage.pl
copyimage.pl
#!/usr/bin/perl use warnings; use strict; use File::Copy; my $newImage = "/home/pi/uvccapture/snap.jpg"; my $destdir = "/home/pi/uvccapture/images"; my $frames = 43200; chdir $destdir or die "cannot change directory"; my $newest_file = 'ls -t | head -1'; chomp $newest_file; my $lastNum = 0; my $currentNum = 1; if ($newest_file =~ m/(.*?)\.jpg/) { $lastNum = $1; if ($lastNum < $frames) { $currentNum = $lastNum + 1; } copy($newImage,"$destdir/$currentNum.jpg") || print "\n Failed to copy $newImage\n"; }