Wednesday, March 5, 2014

DOS Daily batch script template

Sample DOS daily batch script.
Key feature is that it includes a date field.

@ECHO off

ECHO Set filename
SET fname=landing\SET_EOD-%date:~6,4%%date:~3,2%%date:~0,2%.txt

ECHO Getting SET EOD data ...
current_set_price.pl > %fname%

ECHO Loading SET EOD data to database ...
psql -U turtle -c "\copy eod_prices_set FROM %fname% NULL AS '-';"