# Arara rule to remove all files except 'tex' and 'pdf'

I have this example

% arara: pdflatex
% arara: pdflatex
% arara: clean: { files: [test.log,test.aux] }
\documentclass{article}
\usepackage{lipsum}

\begin{document}

\tableofcontents

\section{Section one}

\lipsum[1-5]

\section{Section two}

\lipsum[1-4]

\end{document}


I want to remove all auxiliary files except tex and pdf files, with % arara: clean: { files: [test.log,test.aux] } you can remove log and aux files, what I need is also to remove all created test.* files leaving only test.tex and test.pdf

Rather then % arara: clean: { files: [test.log,test.aux,test.toc,test.lof,test.lot,.....] } is there a possibility to just only mention the remaining files in this case test.tex and test.pdf

• Stupid question: Can't you just add the other files in the list? – user36296 Jun 18 '17 at 18:54
• You could make a new clean rule to use your own delete script instead of rm (which is what the default clean uses.) But as @NicolaTalbot says in her comment, "delete all except" scripts are dangerous; I have a script rmaux which deletes all files with particular extensions. This is a safer way to proceed. – Alan Munn Jun 18 '17 at 19:35
• Could be quite dangerous to do that. What if you later decide to add an important file to that directory that doesn't have .tex or .pdf extension? – Nicola Talbot Jun 18 '17 at 19:35
• My folder contain only test.tex file and I want only test.tex and test.pdf in this folder after compilation – Salim Bou Jun 18 '17 at 19:40
• Hi Salim. Do you know how to do this with the current version (4.0) of Arara? – Evan Aad May 11 at 9:23

For arara 3.0 you could do:

% !TeX program = txs:///arara
% arara: pdflatex
% arara: lmkclean

\documentclass{article}

\begin{document}
test
\end{document}

• Does it works also for Windows? I tried but I got this error: Can't locate Digest/MD5.pm in @INC (you may need to install the Digest::MD5 module) – CarLaTeX Jun 20 '17 at 20:33
• @CarLaTeX No idea, I don't have windows. – user36296 Jun 20 '17 at 21:21
• @CarLaTeX The reason it doesn't work for you is that either you don't have a perl installation or you don't have the Digest::MD5 module. Download perl (e.g. ActivePerl, Strawberry Perl) and install the required module from its package manager. Perl usually comes with the Linux distributions, that's why user36296 did not have problems with it. – Zoltán Csáti Aug 27 at 16:50
• @ZoltánCsáti Thank you, I'll try! – CarLaTeX Aug 27 at 18:13