Is it possible to have LaTex create folders(directories) in windows I know this is probably impossible , but I've been asked to verify. Pretty sure it's not, that's really not what LaTex is meant for. I've made plenty of research and obtained nothing.
Asked
Active
Viewed 3,486 times
3
1 Answers
5
This may be helpful.
\immediate\write18{md dir}
this create a (dir) directory in the current directory (location of .tex file). I can't do it for absolut path (for example
\immediate\write18{md D:[path]dir}
does not work for me. But we can do it like this
\documentclass{article}
\begin{filecontents*}{mtcd.txt}
@echo off
md D:\pardir\bar
cd D:\pardir\bar
echo hellow world > test.tex
\end{filecontents*}
\begin{document}
\immediate\write18{ren mtcd.txt mtcd.bat}
\immediate\write18{mtcd.bat}
\immediate\write18{del mtcd.bat}
\end{document}
Here we make a .bat file and run it to make our directory after that we delete it.
Edit: Here I complete the example, we can run pdflatex to compile the file created
\documentclass{article}
\begin{filecontents*}{mycmd.txt}
@echo off
set path=D:/mtTex/miktex/bin;%path%
md D:\pardir\bar
cd D:\pardir\bar
(
echo \documentclass{book}
echo \usepackage{lipsum}
echo \begin{document}
echo test
echo \lipsum[1-5]
echo \end{document}
)> test.tex
pdflatex test.tex
\end{filecontents*}
\begin{document}
\immediate\write18{ren mycmd.txt mycmd.bat}
\immediate\write18{mycmd.bat}
\immediate\write18{del mycmd.bat}
\end{document}
touhami
- 19,520
mkdir -p /path/to/new/directorywork on Windows? – cfr Mar 30 '15 at 18:40