How do I create a directory on remote host if it doesn't exist without ssh-ing in?

后端 未结 6 1973
南笙
南笙 2021-02-01 00:57

I\'m not sure if this is possible or not. Basically, I\'m writing a script that allows me to scp a file to my hosting. This is it so far. Argument 1 is the file and argument 2 i

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-01 01:33

    If you do a recursive scp (-r), it will copy directories as well. So if you create a directory of the name you desire on the remote host locally, copy the file into it, and then recursively copy, the directory will be created, with the file in it.

    Kind of awkward, but it would do the job.

提交回复
热议问题