# Include ALL pdf graphics in document

I have several plots saved as .pdf in a folder and I would like to know if there is a way of adding all of them in a document at once, without typing the path to each file.

-
short answer no, longer answer, if you are prepared to allow latex to escape to the shell and run system commands, and don't mind your document being system dependent you could get it to run ls *.pdf(or whatever is needed) and construct the list. (or you could just do this before starting latex) – David Carlisle Feb 18 '14 at 17:39

It is best to do this externally to latex (although you can use the shell-escape (write18) feature to execute the commands from within latex if you want.

I'll assume bash syntax but other command line systems can do similar.

Suppose you have a directory/folder `img` with three pdf files

``````\$ ls img
a.pdf  b.pdf  other.pdf
``````

and you want to include them in alphabetic order (or any other order you can achieve by using arguments to `ls` or some other command)

then executing

``````ls img/*.pdf | sed -e "s/.*/\\\\includegraphics{\\0}/" > img/imglist.tex
``````

would leave a file `img/imglist.tex` that looks like

``````\includegraphics{img/a.pdf}
\includegraphics{img/b.pdf}
\includegraphics{img/other.pdf}
``````

so you just need `\input{img/imglist}` in your main file, and arrange to regenerate `imglist.tex` every time you update the image directory (or every time you run latex).

-