# Have a custom PDF output path for each .tex file

With reference to this question:

Path for saving PDF in TexStudio

Is there any way I can have a custom output path for the PDFs for each different .tex file I compile?

For instance, I want to put File1.pdf in one folder on my computer, and File2 in completely different one.

• If you're talking about TeXstudio, I think you can try with magic comments. Though personally I would do a copy of the pdf into custom folders, instead of directly outputting them there. In this case, Tim's answer in your linked qn should work well if implemented as a magic comment, specific to each .tex file. – Troy Mar 23 '18 at 12:11

I had the same question as the OP.

As far as I know, this is not possible within TexStudio.

One could of course use an external script (in your preferred programming language) that would determine by e.g. a prefix in the filename where to move the compiled PDF (e.g. all tex/tikz figures output PDFs end up in a "figures" folder etc.).

It would however be a very nice feature, if this would be included in TexStudio.

You could use magic comments to mv the pdf file into a folder of your choice after compilation:

% !TeX TS-program = pdflatex % | mv %.pdf ./test/.

\documentclass{article}

\begin{document}
test
\end{document}