I'm just learning to use sftp, and I want to copy a directory from the remote computer to my local computer. If I try

get [directory]

it gives me this error:

Cannot download non-regular file: /home/mpirocch/Documents

get -R doesn't work, either.

link|improve this question

feedback

8 Answers

up vote 7 down vote accepted

Don't use the sftp program directly if you can find something better. For Linux, many file managers (at least Nautilus and Dolphin, the GNOME and KDE ones) support sftp natively, and there's always sshfs. For windows, there's WinSCP, and probably others. The point of all of these is to let you access files over sftp as if they were on a regular filesytem, so you don't have to care that you're accessing them over sftp.

link|improve this answer
Wow, nautilus does work very well with SFTP. I added a bookmark in Nautilus, and now it's all ridiculously easy. Thanks! – Matthew Sep 13 '09 at 14:13
feedback

Use:

scp -r mpirocch@my-server:/home/mpirocch/Documents Documents
link|improve this answer
This works, but it would be nice to be able to do this from SFTP (so I can see what I copy before I copy it). Is this possible? – Matthew Sep 12 '09 at 22:53
@Matthew: I don't think so. I have been asking myself the same question for some time and the best answer that I have for the moment is scp -r. Or you could use an advanced SFTP client like Filezilla. – Cristian Ciupitu Sep 12 '09 at 23:53
feedback

get -r *

Worked for me..

link|improve this answer
1  
Thank you for putting an answer that actually answers the question. – jonnyflash Jan 19 at 19:56
feedback

use lftp like:

lftp sftp://user@host

and then use the mirror command to recursively download (mirror -R to recursively upload).

link|improve this answer
+1 lftp is like a little bundle of magic and joy! – WCWedin Apr 27 '11 at 13:32
feedback

Try mget instead of get.

Clarification: mget will work if you are inside the directory you want to copy; if you do something like this:

sftp> cd dir_to_get
sftp> mget *

it will get all the files in that directory. However, it will not recursively get the contents of any subdirectories.

link|improve this answer
mget doesn't work any better than get for me. – Matthew Sep 12 '09 at 22:53
feedback

I have Java dist folder in remote server, where i have following tree:

- dist
--- Audio.jar
--- README
--- lib
----- lib.jar

Goal is: I want to use SFTP? And put them in /tmp/<>

Step 1. sftp remoteuser@ip

Step 2. cd /var/tmp

Step 2. lmkdir /tmp/dist; lmkdir /tmp/dist/lib

Step 3. lcd /tmp/dist

Step 4. mget *

Step 5. lcd /tmp/dist/lib

Step 6. mget *

Step 7. finally i have my goal

$ ls
Audio.jar  lib  README.TXT
link|improve this answer
feedback
get -r [directory]

gets [directory] and everything under it, where r stands for recursive. I found this just by typing help from sftp.

link|improve this answer
feedback

FileZilla is the best client I have used, which of course can use SFTP underneath:

The GUI make is easy to copy over a whole directory.

link|improve this answer
feedback

protected by studiohack Mar 14 at 21:33

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

Not the answer you're looking for? Browse other questions tagged or ask your own question.