R - 将文件写入()到SAMBA共享 [英] R - write() a file to a SAMBA share

查看:162
本文介绍了R - 将文件写入()到SAMBA共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个加载到R的文件,我想转移到一个samba共享中。

类似于

write(some-file,file =| smbclient -U user // ip password)



它连接到桑巴然后(我认为)输出是执行在 smb:\> ,我不希望该文件被执行,我不知道如何通过smbclient中的 put 函数将文件传递到目的地。






编辑:这不是第一篇文章的同样的问题。第一篇文章是由我解决和回答的。那里连接到桑巴。现在我已经连接到它,但是write()函数不会生成一个文件,而是单独地输出文字。我只是想知道如何使它在一个句子中创建一个文件。

解决方案

我通过改变哲学找到了答案:

首先,我在本地写文件,比如

  write那么我使用system()函数来调用smbclient并把文件放在一个文件中已经写好了

pre $系统(smbclient -U用户// ip / dir密码-c \把some-file some-我的脚本比较复杂,它在一个Shiny应用程序中,但总的来说是解决方案

I have a file loaded in R that I want to move to a samba share

It is something like

write(some-file, file = "|smbclient -U user //ip password")

It connects to the samba but then (I think) the output is "executed" in the smb: \> and I don't want the file to be executed, I don't know how to pass the file to the destination with a putfunction inside smbclient.


Edit: This is not the same problem as the first post. The first post is solved and answered by me. The point there was connecting to samba. Now I'm already connected to it but the write() function doesn't make a file, instead it pipes out the words separately. I just wanted to know how to make it create a file in a sentence.

解决方案

I found the answer by changing the philosophy:

First, I write the file locally, like

write(some-file, there)

Then I use the system() function to call smbclient and put the file already written

system("smbclient -U user //ip/dir password -c \"put some-file some-file\"")

My script is more complex and it's inside a Shiny app but in summary that's the solution

这篇关于R - 将文件写入()到SAMBA共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆