Automate scp file transfer using a shell script

前端 未结 13 1084
误落风尘
误落风尘 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 17:58

    rsync is a program that behaves in much the same way that rcp does, but has many more options and uses the rsync remote-update protocol to greatly speed up file transfers when the destination file is being updated.

    The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network connection, using an efficient checksum-search algorithm described in the technical report that accompanies this package.


    Copying folder from one location to another

       #!/usr/bin/expect -f   
       spawn rsync -a -e ssh username@192.168.1.123:/cool/cool1/* /tmp/cool/   
       expect "password:"   
       send "cool\r"   
       expect "*\r"   
       expect "\r"  
    

提交回复
热议问题