Bug 520 - Recursive operations for sftp
Summary: Recursive operations for sftp
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: -current
Hardware: All Linux
: P2 enhancement
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords: low-hanging-fruit
Depends on:
Blocks: 634
  Show dependency treegraph
 
Reported: 2003-03-25 14:11 AEDT by Damien Miller
Modified: 2010-04-16 15:50 AEST (History)
1 user (show)

See Also:


Attachments
Add recurse mode to sftp put command via fts. (20.20 KB, patch)
2004-12-07 17:28 AEDT, Chase Phillips
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Damien Miller 2003-03-25 14:11:04 AEDT
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.
Comment 1 Ben Lindstrom 2003-03-27 09:06:06 AEDT
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.
Comment 2 Chase Phillips 2004-12-07 17:28:14 AEDT
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 3 Chase Phillips 2004-12-07 17:46:52 AEDT
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.
Comment 4 Scott Ritchie 2009-09-06 14:55:49 AEST
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 :)
Comment 5 Damien Miller 2009-12-08 11:14:10 AEDT
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
Comment 6 Damien Miller 2010-04-16 15:50:17 AEST
Mass move of bugs RESOLVED->CLOSED following the release of openssh-5.5p1