Related Entries

10 annoying office phrases
Switch!
Excellent article on outsourcing
Language skills for programmers
Process Change

« Bicycle Diaries - I
» Quick Start: Git for personal use

Quick script to maintain a diary

This is easy in bash; posting it to help people stuck in Windows XP.

I like to keep my daily notes in a folder in the filesystem with filenames yyyymmdd.otl, using VIM Outliner. Here is a small DOS script to make a file for a day if it doesn’t exist and then open it. Name it as diary.cmd and keep in your path.

@echo OFF
@REM your preferred editor
set EDITOR=c:\tools\vim\vim72\gvim.exe
@REM where do you want to keep your files? It looks
@REM for a file called template.otl for creating new entries
@REM see below to turn that off and instead use the last modified file
set DIARYDIR=q:\tracker\diary\

@cd /d %DIARYDIR%

@REM get today’s date in yyyymmdd format
set YYYYMMDD=%DATE:~10,4%%DATE:~7,2%%DATE:~4,2%
IF EXIST %DIARYDIR%\%YYYYMMDD%.otl GOTO openfile
@REM copy template.otl %YYYYMMDD%.otl
@REM if you rather copy last modified file, uncomment the version below
@REM and comment out copying template file
for /f "tokens=*" %%a in ('dir /b /od 2*.otl') do set lmf=%%a
copy %lmf% %YYYYMMDD%.otl

:openfile
@REM "start" will close the dos window after editor started
@REM START %EDITOR% %YYYYMMDD%.otl