# Automatic new directory for new files

I am looking for some way to have a tidy folder system.

My idea is, when I create a new file for latex to automatically create a new folder under the same name inside my working directory and put all files in that folder (`.aux`, `.pdf`, `.tex`, `.loc` etc). It might be the case that some package does that, but I am relatively new to this.

Do you know any way of achieving something like this?

-
Welcome to TeX.sx! We typically do not include greetings or thanks in Q-A. Upvoting comments or answers is the preferred way to show appreciation. –  Peter Jansson Jan 18 '13 at 14:55

`latex` has the `-output-directory` option. In Linux with the `bash` shell you can use the shell script

``````#!/bin/sh
name=`basename \$1 .tex`
if [ ! -d "\$name" ]; then
mkdir \$name
fi
latex -output-directory \$name \$1
``````

Save the above code to somewhere in your `\$PATH` called `newlatex.sh` and remember to `chmod` it `700`. Then from the directory in which you placed the `.tex` file call

``````\$ newlatex.sh filename.tex
``````

or

``````\$ newlatex.sh filename
``````
-
Anything similar for (lame) Windows? –  korni Jan 19 '13 at 19:10
I am not that familiar with Windows, but if MikTeX (or whatever LaTeX distribution you use) supports command line commands, and if your IDE allows you to change the command used to compile the document, then in principle you can write a batch file to do so. But if you want a more tailor-made solution, please edit your original post to include (1) Operating system [I assume Windows] (2) LaTeX distribution (3) Any software you use in the workflow to create your document: what editor you use, how you compile the TeX file into DVI/PDF etc. –  Willie Wong Jan 21 '13 at 8:51