Automate scp file transfer using a shell script

前端 未结 13 1087
误落风尘
误落风尘 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:54

    you could also use rsync. It seems to work better for multiple files than scp IMHO.

    rsync -avzh /path/to/dir/ user@remote:/path/to/remote/dir/

    Update

    You can use rsync via ssh by adding the '-e' switch:

    rsync -avzh -e ssh /path/do/dir/ user@remote:/path/to/remote/dir/

提交回复
热议问题