Nov 212013

It’s that time again! Another construction project at work!

It was decided that I would run another time-lapse webcam of the construction process. This was a little last-minute. Our electrician mounted an analog camera and plugged into a network video encoder.

I haven’t had time to set up a proper linux box to manage all this so I threw together a batch file and a scheduled task to run on my workstation every 5 minutes until I get the rest set up.

I love how easy it is to get a jpg off the Axis M7001 Video Encoder

I’m familiar (and a fan of) wget. The win32 version works pretty well too.


This uses my favorite method of generating zero padded time & date stamp files. It concatenates 0 and the variable then selects the right 2 characters.


@echo off
REM Create the date and time elements.
for /f "tokens=1-7 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $d $t"') do (
   for /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
      set %%a=%%j
      set %%b=%%k
      set %%c=%%l
      set hh=%%m
      set min=%%n

REM zero-pad and see the result
set mm=0%mm%
set mm=%mm:~-2%
set dd=0%dd%
set dd=%dd:~-2%
set hh=0%hh%
set hh=%hh:~-2%
set min=0%min%
set min=%min:~-2%

echo %yy%%mm%%dd%%hh%%min%

set outFile=C:\construction_cam\%yy%%mm%%dd%%hh%%min%.jpg

"C:\Program Files (x86)\GnuWin32\bin\wget.exe" -O %outFile%

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>