Microsoft’s Task Scheduler rarely cuts it in the real world. Cron does but I didn’t want to have to install Cygwin and play around with it. I found nnCron instead (I’m using the LITE version) and was quickly able to set up an hourly job that runs during working hours. The job calls a DOS batch file that makes a couple of calls to SyncToy folder sets which echo my working copies across to a network share just in case, when I’m working on a large piece of code, I’ve not checked in and something goes horribly wrong. Very reassuring.

The line in the cron.tab:
# echo working copies to a network folder every hour between 8am and 6pm every weekday.
0 8-18 * * 1-5 "C:\Documents and Settings\My Account\My Documents\scripts\synctoy_echo.bat"

The lines in the batch file:
REM Use SyncToy at the command line to run folder sets.
REM The SyncToy syntax requires the use of quotes and that tends to confuse DOS so
REM fire each call to SyncToy in its own shell, use /C to terminate the shell after SyncToy has run and
REM use the /S flag to indicate the use of more than two quotation marks on the command line (/S will strip
REM the first and last of them and present the rest to the shell).
cmd /S /C ""C:\Program Files\SyncToy\SyncToy.exe" -R"SVN Echo""
cmd /S /C ""C:\Program Files\SyncToy\SyncToy.exe" -R"ESPC Echo""


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s