# Is there a way to automatically delete auxiliary files after compilation? [duplicate]

When I compile my `.tex` file, it generates a lot of different files (with extensions such as `.aux`, `.log`), but all I want is the `.tex` and `.pdf` files. Those files just fill my hard drive for nothing. Is there any trick to make LaTeX retain only the `.pdf` and `.tex` files and delete everything else after compilation?
LaTeX needs temporarily these files, in order to be able to make a table of contents, a bibliography, cross references, etc. Usually, dedicated tex editors have a button to delete these file, when they aren't useful anymore. In the case of TeXmaker, the `Tools` menu has a `Clean`submenu. –  Bernard Feb 24 '14 at 21:07