Automate scp file transfer using a shell script

前端 未结 13 1038
误落风尘
误落风尘 2020-11-30 17:24

I have some n number of files in a directory on my unix system. Is there a way to write a shellscript that will transfer all those files via scp to a specified remote system

13条回答
  •  借酒劲吻你
    2020-11-30 18:15

    This will work:

    #!/usr/bin/expect -f
    
    spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no file1 file2 file3 user@host:/path/
    expect "password:"
    send "xyz123\r"
    expect "*\r"
    expect "\r"
    interact
    

提交回复
热议问题