> On Mar 28, 2018, at 8:39 PM, stardiviner <[email protected]> wrote:
>
> `:results file` will write non-empty result to `:file`. But `:results link`
> don't, it just insert a link of `:file` at result. And that is what I want to
> solve in the first post of this thread.
The :post header arg will allow this.
In the examples below the first code line in the src block writes a file that
is not subsequently overwritten.
#+name: file-output
#+begin_src emacs-lisp
(org-babel-result-to-file *this*)
#+end_src
#+begin_src R :results raw :post file-output()
cat("this is a test",file="testit.out")
"testit.out"
#+end_src
#+RESULTS:
[[file:testit.out]]
#+name: file-output2
#+begin_src emacs-lisp :var fname="xxx"
(org-babel-result-to-file fname)
#+end_src
#+begin_src R :results raw :post file-output2("testit2.out")
cat("this is a test",file="testit2.out")
#+end_src
#+RESULTS:
[[file:testit2.out]]
HTH,
Chuck