# Does LuaTeX access write18 differently from pdftex? [closed]

Im trying to make a speedup-option for gnuplottex using md5 checksums. This works like a charm for pdftex, but it fails for LuaTeX. The comparison of the checksums work, the difference occurs when

\immediate\write18{mv "\subfolder\testname.gnuplot" "\subfolder\figname.gnuplot"}


occurs. With pdftex the file gets overwritten correctly, with LuaTeX I get the message

mv: cannot move gnuplottex\\Main-gnuplottex-test1.gnuplot' to gnuplottex\\Main-gnuplottex-fig1.gnuplot': Permission denied


Is there maybe a difference in how Luatex and pdflatex work, concerning write18? On the other hand, as I am on Windows the reason may also be that I used

\def\subfolder{gnuplottex\@backslashchar}


which appears in the case of LuaTex as

mv: cannot move gnuplottex\\Main-gnuplottex-test1.gnuplot' to gnuplottex\\Main-gnuplottex-fig1.gnuplot': Permission denied


If this is the problem, how can I get rid of the double backslashes? I don't add another one as far as I know. Thanks in advance for your help and please forgive my poor description of the problem.

## closed as unclear what you're asking by egreg, Mico, Torbjørn T., Mensch, user13907 Oct 4 '14 at 22:15

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Fyi Lua comes with the function os.renam() for that exact purpose. Makes it easy to work around escaping hell. And btw. there is a builtin MD5 library as well. – Philipp Gesang Sep 6 '13 at 21:47
• FWIW, you can also look at the implementation of the filter module of ConTeXt which provides similar functionality for ConTeXt. (Look at t-filter.mkiv, which is for LuaTeX). – Aditya Sep 6 '13 at 22:04
• I have just tried to reproduce the problem on my linux machine (with \def\subfolder{test/}) and it worked for both lualatex and pdflatex with -shell-escape. AFAIK, the / will also work on windows systems, and it does not need escaping. On the other hand, a backslash will not work on *nix systems (I tried it to check if latex makes auto-substitutions). – Christian Feuersänger Sep 7 '13 at 2:40
• Possibly relevant here is the distribution you are using: TeX Live, MiKTeX, something else? (OS-specific stuff is no built in to TeX but rather depends to some extent on who builds the binaries.) – Joseph Wright Sep 7 '13 at 6:52
• BTW, something odd is going on here anyway as mv is not a Windows command, so it really shouldn't work at all. You can use / as the path separator on Windows, not only within TeX programs but also at say the Command Prompt. Thus that is the way I would strongly recommend handling stuff within TeX. – Joseph Wright Sep 7 '13 at 6:58