I've been working on porting some korn shell scripts to apache ant lately. In the rewrite, I had to implement some sftp steps. Some were straight forward, get file. Others, I had to remove files via the sftp connection. The ant "scp" task doesn't provide this. So, I had to basically mimic the shell script implementation. Here is a sftp directory list:
I learned two things here. First, how to pass commands in general via sftp, which I never had to do. Second, how to do it via ant, meaning not doing it in ant and calling to the shell via ant.