How to force rsync to create destination folder

前端 未结 3 1999
慢半拍i
慢半拍i 2021-02-01 14:25

Example:

rsync /tmp/fol1/fol2/fol3/foln user@addr:/tmp/fol1/fol2/fol3/foln

My main problem is folder /tmp/fol1 doesn\'t exist on remote machine

3条回答
  •  天涯浪人
    2021-02-01 15:01

    One trick to do it is to use the --rsync-path parameter with the following value:

    --rsync-path="mkdir -p /tmp/fol1 && rsync"
    

    With --rsync-path you can specify what program is going to be used to start rsync in the remote machine and is run with the help of a shell.

提交回复
热议问题