A working copy for the weekend

Sometimes it’s good to be able to review some code out of working hours when you suddenly have some inspiration. Using nncron, svn export, 7z and FTP (TLS) I’ve been able to automate this quite easily.

In cron.tab:
# at 5pm export a working copy, archive it and transfer the archive by FTP over TLS.
0 17 * * 1-5 CMD /K "C:\Documents and Settings\Placeholder\My Documents\scripts\svn_export.bat"

In the batch file:
set project=myProject
REM Export the working copy.
"C:\Program Files\Subversion\bin\svn.exe" export --ignore-externals C:\svn\%project% C:\svn\export\%project%
REM Create an archive of the files.
"C:\Program Files\7-Zip\7z.exe" u "C:\svn\export\%project%.7z" "C:\svn\export\%project%\*"
REM Move the archive to another location.
"C:\Program Files\BlueZone FTP\Bzftpf.exe" /Fdummy.zft /Z0 /L"MPUT *.7z" /L"EXIT"

I used the BlueZone Secure FTP Client as it supports FTP over TLS (I don’t want my login being broadcast) and it was scriptable. I use 7-Zip as the 7z archive is smaller than a ZIP file (over 40% smaller). I had to install Subversion as although TortoiseSVN is scriptable its ‘export’ function wasn’t exactly what I wanted (my current working copy without unversioned files).

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