I know, I know, you’ve been waiting your whole life for this.

Download beta SFTP Processing library (source included in zip).

Download example Processing sketch.

The library uses JSch (Java Secure Channel).
Copyright (c) 2002,2003,2004,2005,2006,2007 Atsuhiko Yamanaka, JCraft, Inc.

import sftp.*;

Sftp sftp;

void setup() {
  size(200,200);
  background(0);
  // Create the SFTP object
  // if 3rd arg = false, you must set the password in your code
  // if 3rd arg = true, you will be prompted to enter your password
  sftp = new Sftp("www.hostname.com","login", true);
  // sftp.setPassword("XXXXXX");
  sftp.start(); // start the thread
  noLoop();
}

void mousePressed() {
  // At any point you can execute an SFTP command
  // Not all commands are currently implemented
  // but you do have "ls" and "get"
  // Gosh, I should implement "put", sorry!
  sftp.executeCommand("ls");
  sftp.executeCommand("get file.txt");
}

One Response to “Sftp with Java / Processing”  

  1. 1 Peter Kirn

    Excellent … but now I think Amazon S3 support must be next. :) I’ll let you know how I fare. Everything’s documented for, like, real programmers with jobs and such, instead of … erm … me.

Leave a Reply