3

I want to copy a few folders from Server A (/aaa/bbb/ccc/) to Server B (/xxx/yyy/zzz/), considering Server A is source and Server B is destination.

There are multiple folders in ccc/ which need to be copied inside zzz/.

I tried using sftp which is only available option for me and should be executed from destination not from source and tried to connect source

In Console (SERVER B) :

 [user zzz]$ sftp hostname.domain.com

 ------ Connected -------

 sftp> get -r /aaa/bbb/ccc/

It returns:

get : Invalid flag -r

Server we are using is RedHat Enterprise, Need to copy the folders.

EDIT 1.

sftp> get -r / aaa / bbb / ccc /
get: Invalid flag -r
sftp> Write failed: Broken pipe

sftp> version
SFTP protocol version 3
7
  • Does your man page for sftp suggest that '-r' is a valid option ? man sftp | grep "get "
    – steve
    Commented Sep 22, 2017 at 21:19
  • You say, “There are multiple folders in ccc/ which need to be copied inside ddd/.” Do you mean, “There are multiple folders in ccc/ which need to be copied into zzz/.”? Commented Sep 22, 2017 at 21:43
  • What is your version of sftp? It may be that only the -P flag is implemented for the get command in the version you're using. Check your manual.
    – Kusalananda
    Commented Sep 23, 2017 at 20:28
  • @Scott Yes My Mistake, it should be copied into zzz/ Commented Sep 24, 2017 at 10:24
  • @steve It returned nothing when I ran man sftp | grep "get " Commented Sep 24, 2017 at 11:17

1 Answer 1

3

Use:

sftp -r server@address
sftp> get /dir/to/path/files/

You could also try wildcards to get this to work as well.

sftp> get /dir/to/path/files/*
sftp> get /dir/to/path/files/*. *  #minus the space after the period.
1
  • Thanks for the formatting Jeff, how did you do that? Commented Nov 17, 2018 at 22:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .