I am working on shell script that is supposed to transfer files (with their subdirectories) from a Windows Server to a Linux-Samba server. The Windows server is setup to accept sftp requests and I am logging into the Windows server with shared ssh keys so there is no need for a password exchange. I can log into the Windows from the linux server with this command:
sftp user@host_name
It executes the sftp command and logs me into the Windows server. When I try to use the:
get -r /home_directory/first_level/* /local/directory/to/put/files
I get an error message saying "Invalid flag -r". I can't use SCP because it is not enabled on the server.
What can I do in order to recursively copy all the files and directories from the Windows server to the linux server using a shell script?
您可以将Cygwin安装到Windows服务器上,然后从那里启动一个scp -r
。
Could you show us a bigger snippet of the script?
Also, the get
keyword is part of sftp
lingo, are you doing something like this?
#!/bin/bash
sftp -v -oIdentityFile=path user@server<<-_EOF_
get -r /home/dir/first_level/* /local/dir/to/put/files
bye
_EOF_
# etc etc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.