19 July 2007

Batch SFTP

If you have a bunch of files on Windows that need to be moved over sftp regularly there are many hurdles. In the world of Linux it would be a one liner, and even in Windows it "can" be. Let me show you how:

First get the WinSCP standalone application here: http://winscp.net/eng/download.php

Execute the standalone app to get the key saved into the ini of the program (this must happen once so that further command line calls to the same server won't fail)

Create a .txt file to provide WinSCP settings contents:

option batch on

option confirm off

open username:password@server.com

cd /HOME/location/

put c:\temp\*.*

close

exit

Create a .bat batch file to provide the windows scripting:

winscp403.exe /console /script=settings.txt

if errorlevel 1 goto error


echo Upload succeeded, moving local files

move c:\temp\*.* c:\uploaded

exit


:error

echo Upload failed, keeping local files

And that's it, double click your .bat file, or execute it programmatically. WinSCP is a great tool when linux isn't an option.

18 July 2007

My New Car!

On a personal note: I got a new car!!!!

This will be the first car I'm paying for out of pocket myself.

Nissan Altima 2007 4 cylinders. Originally I was going to get a V6 Camry, but turns out that since the Altima has a cool Continually Variable Transmission it feels just as fun as a V6 to drive. Actually the CVT is an interesting piece of engineering technology read about it here.