Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On machine A I have the folder


On machine B I have the folder


I wish transfer all files, directories and sub-directories of /home/a in /home/b with sftp On machine A I tried the commands:

sftp [email protected]
put /home/a/* /home/b/

but it doesn't work, i get the error message: "skipping non-regular file /home/a/a1"... [a1 is a sub-directory of a]
How could I modify the put instruction?

Thanks! :)


I solved using scp:

scp -r /home/a/ [email protected]:/home/b/
share|improve this question
put -r would have worked too. –  WakiMiko Feb 8 '12 at 16:07
Ok but how could I know that for "put command" the option -r is available? If I look here only the flag -P is described... The same in the manual Thanks! :) –  fibon82 Feb 9 '12 at 0:37
You should post that as an answer instead. –  N.N. Mar 7 '12 at 20:20
add comment

migrated from stackoverflow.com Feb 8 '12 at 13:57

This question came from our site for professional and enthusiast programmers.

4 Answers

up vote 8 down vote accepted

Although not strictly equivalent to sftp, rsync is a very powerful alternative for scp and sftp, especially when updating the copies from machine A to machine B, as it doesn't copy the files that haven't been altered; it's also able to remove files from machine B that have been deleted from machine A (only when it's told to of course).

In your case, the syntax would be

rsync -zrp /home/a/ [email protected]:/home/b/

The -r option is for recursively copying files, -z enables compression during the transfer, and -p preserves the file permissions (file creation, edit, etc.) when copying, which is something that scp doesn't do AFAIK. Many more options are possible; as usual, read the man pages.

share|improve this answer
Ah thank you! :) A new thing that I learned! –  fibon82 Feb 9 '12 at 0:08
@fibon82: You're welcome :) –  Karolos Feb 9 '12 at 6:47
i love you, i synced 400MB of data in 1 minute by just using your code. I would add you should also use --progress otherwise you'll be staring at nothing without knowing what's happening (and at what speed :) ) –  Sandro Antonucci Dec 18 '12 at 22:18
add comment

scp is the Linux de facto for transferring files over SSH. In your case you would want to use the recursive switch, e.g.:

scp -r /home/a/ [email protected]:/home/b/
share|improve this answer
sftp and scp are actually different protocols, both based on ssh. –  paradroid Feb 8 '12 at 16:20
Yes, if the server only allows sftp protocol, this answer does not work. –  ruffp Dec 6 '13 at 14:05
add comment

Try using

put -r /home/a/ /home/b/

for more info check out: this

share|improve this answer
add comment

In my case rsync wasn't possible so I used:

mput -rp /home/a/ /home/b/
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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