# Can LaTeX automatically search directories and \include discovered files?

I have a master document that has a lot of entries like the following:

``````\include{entries/20141212-some-article/entry}
\include{entries/20141215-another-article/entry}
\include{entries/20141225-christmas/entry}
\include{entries/20141231-eve/entry}
``````

I have each section in its own subdirectory under an `entries` subdirectory. The file in each subdirectory, as you can see, is called `entry.tex`. Because each subdirectory is dated, I can sort by the directory name to get the correct order.

I'd like to avoid having to modify this list in the master document every time I add an article. How can I write some LaTeX code to search subdirectories for these files and include them if found? I have been unable to find documentation that describes these kind of file search operations.

• If you are prepared to use -shell-escape you could get latex to run `ls -R ` to obtain a file list (or the equivalent in the operating system you use) and then use some macros to convert that to a list of includes. But really, I wouldn't it makes the document fragile and non-portable and the whole point of `\include` is to filter with `\includeonly` for which you need the names anyway. If you just want to concatenate them all do `cat */*/*.tex > tmp.tex; pdflatex tmp` – David Carlisle Feb 6 '15 at 16:06