add tag
निरंजन
I want to create a rule for removing all the files except .tex and .pdf and use it with `arara`. With the help from [this](https://unix.stackexchange.com/a/153863/360801) I managed to write something like the following in bash.

```bash
find . ! -name 'myfile.tex' ! -name 'myfile.pdf' ! -name '.araraconfig.yaml' -type f -exec rm -f {} +
```

which removes all the files except `myfile.tex`, `myfile.pdf` and `.araraconfig.yaml`.

Suppose I write this command as a function in my `.bashrc` like in [this](https://tex.stackexchange.com/a/119246/174620) answer; it'll be useful only when working on my computer. I want to write a rule which can be executed on any system having `arara` and my TeX source (and of course bash/the programming language used for removing files).

So my question is can I define the desired function in `.araraconfig.yaml` itself?

Otherwise in `rules/` directory which is located in my working directory?

Which programming language would be better suited for this purpose as bash might be unusable on windows? I have decided to use `arara` as anyways I am going to need it for other automated tasks, so an `arara` solution will be much preferred.
Top Answer
samcarter
Instead of reinventing the wheel, simply use the build in `clean` rule from arara:

```
% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode}
% arara: pdflatex: {synctex: on, interaction: nonstopmode}
% arara: clean: { extensions: [ log,aux,dvi,lof,lot,bit,idx,glo,bbl,ilg,toc,ind,out,blg,nav,snm,synctex.gz,vrb,repo,bcf,fdb_latexmk,fls] }
\documentclass{beamer}

\begin{document}
	
\begin{frame}
	abc
\end{frame}	
	
\end{document}  
```

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.