The sftp client should support recursive operations. For example, "get -R somedir" should copy the directory tree rooted at somedir. Probably achieve this by forking a copy of OpenBSD's fts routines (libc/gen/fts.c) and teach them sftp.
fts would be easy enough to use for recursive. I think 'put' can be written in a matter of a night or two (Assuming one is awake <chuckle>), but there is one minor downfall to fts. It assuming all access is local. And unlike glob it does not support the ability to override opendir(), readdir(), closedir(), lstat () and stat(). Unless there is something I'm missing get and put can't both use fts effectly without forking the code and rewriting small chunks of it. Would be nice if fts could be modified to support virtualizing those function calls, but with it having a chance of going into POSIX (some century) I doubt the API can change much.
Created attachment 749 [details] Add recurse mode to sftp put command via fts. Add recurse mode to sftp put command via fts. Initial work was done against openssh snapshots from 2004/01. The patch is attached here as a contribution to anyone considering adding this feature to sftp. I assume it would require some reworking to be applied against a modern OpenSSH snapshot.
Comment on attachment 749 [details] Add recurse mode to sftp put command via fts. This patch was derived in part from Jared Yanovich's sftp patch posted to openssh-unix-dev in Oct 2003. http://marc.theaimsgroup.com/?l=openssh-unix-dev&m=106498593122963&w=2 I removed the code in my version of the patch that handled the 'recurse' command in sftp but forgot to remove the documentation about that command. Trivial to either add back or to remove the references to it in the docs.
So this bug has been stale for four years, but this feature is still wanted. See, for instance: https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/33378 Has the code here bitrotted? Would someone mind taking care of this wonderful feature? You'll have my gratitude :)
We now have get and put recursion in CVS, developed by Carlos Silva part of the Google Summer of Code. This will be in the openssh-5.4
Mass move of bugs RESOLVED->CLOSED following the release of openssh-5.5p1