Create an remote directory using SFTP / RCurl

2019-03-01 13:49发布

问题:

Is it possible to create a directory on an SFTP site using the RCurl package? I found the sftp_create_dirs function, but I could not find an example how to use it.

I tried to set the ftp.create.missing.dirs option to TRUE, as in

library(RCurl)
opts <- list(ftp.create.missing.dirs=TRUE, 
    ssh.public.keyfile = mypubkey, ssh.private.keyfile = myprivatekey)
ftpUpload("myfile.txt", "sftp://me@www.host.org/newdir/myfile.txt", .opts=opts)

This works if newdir exists, but fails if it does not exists.

Any hint appreciated!

标签: r sftp rcurl