Quote Originally Posted by EdP View Post
Qbasic *cough* *cough*

Be careful, or you'll sound like a barbarian
Tcsh should be much to your liking then. OK back on topic I guess ...
hey don't underestimate the sheer power of qbasic

anyway, this is the latest version of the script, which gives a harddrive time to spin down by temporary storing the files in /tmp/imag

I tested it, and it worked great
here it is:
Code:
#!/bin/sh
#Seconds of sleep before doing another copy
SLEEP=15
#Source JPG file that needs to be copied.
SOURCEJPG=/var/tmp/display.jpg
#Output folder which will contain all the JPG files
OUTPUT=/mnt/webcamimages
#Choose between a counting name or date(not working yet)
#COUNTING   or    DATE
MODE=COUNTING

#Optimize for Harddrive spindown? (TRUE or FALSE)
OPTIMIZE=TRUE
#Save files up to ... in flash
#The max size of an jpeg file is about 65KB so 65*150=9,75MB wich leaves enough of the ~14,5MB flash.
#And if the images are taken every 15sec you will leave the hdd untouched for 37min!
#Please keep in mind that if you set it too high there won't be memory left in /tmp
FLASHSAVE=150
#Flash directory to save in
FLASHDIR=/tmp/imag



COUNT=0
if [ $OPTIMIZE="TRUE" ]; then
	if ( [ ! -d $FLASHDIR ] ); then
		/bin/mkdir $FLASHDIR
		fi
	/bin/rm $FLASHDIR/*
	if [ $MODE="COUNTING" ]; then
			while /bin/true; do
				for i in $(seq 1 $FLASHSAVE); do
					/bin/cp $SOURCEJPG $FLASHDIR/$COUNT.jpg
					COUNT=$(($COUNT + 1))
					/bin/sleep $SLEEP
				done
				/bin/cp $FLASHDIR/* $OUTPUT/
				/bin/rm $FLASHDIR/*
			done
		fi
	else
		if [ $MODE="DATE" ]; then
			while /bin/true; do
			for i in $(seq 1 $FLASHSAVE); do
				/bin/cp $SOURCEJPG $FLASHDIR/img\_$(/bin/date '+%Y%m%d_%H%M%S').jpg
				/bin/sleep $SLEEP
			done
			/bin/cp $FLASHDIR/* $OUTPUT/
			/bin/rm $FLASHDIR/*
			done
		fi
fi
else
	if [ $OPTIMIZE="FALSE" ]; then
		if [ $MODE="COUNTING" ]; then
			while /bin/true; do
				/bin/cp $SOURCEJPG $OUTPUT/$COUNT.jpg
				COUNT=$(($COUNT + 1))
				/bin/sleep $SLEEP
			done
		fi
		else
		if [ $MODE="DATE" ]; then
			while /bin/true; do
			/bin/cp $SOURCEJPG $OUTPUT/img\_$(/bin/date '+%Y%m%d_%H%M%S').jpg
			/bin/sleep $SLEEP
			done
		fi
	fi
another example of the script result:
http://www.youtube.com/watch?v=5LW9RsETEBk