rsync - create all missing parent directories?

前端 未结 7 1507
一个人的身影
一个人的身影 2020-12-29 01:32

I\'m looking for an rsync-like program which will create any missing parent directories on the remote side.

For example, if I have /top/a/b/c/d

7条回答
  •  旧巷少年郎
    2020-12-29 01:54

    A shorter way in Linux to create rsync destination paths is to use the '$_' Special Variable. (I think, but cannot confirm, that it is also the same in OSX).

    '$_' holds the value of the last argument of the previous command executed. So the question could be answered with:

    ssh remote mkdir -p /top/a/b/c/ && rsync -avz /top/a/b/c/d remote:$_

提交回复
热议问题