How to get a list of the filenames of the figures embedded in a document

You can modify the \includegraphcs macro to add to a list and print the list at the end of the document. The MWE below yields the following output:

Figures included were
 images/figA.jpg
 images/figB.png

Notes:

  • In this case \let would have work as well (as per egreg's comment at Resize all images in Latex to a percentage width), but I have gotten used to using \LetLtxMacro from the letltxmacro package for macros which have optional parameters. A detailed description of \LetLtxMacro can be found at this question about a closed square root symbol.

  • The [demo] option is used so as to place a black box where the figure would go for demo purposes, in your real usage (when you actually have the figures available), you need to remove this option.

  • If you wanted to you could use \immediate\write18 and execute the cp shell command within the \foreach loop and have a directory at the end of typesetting which has the images that were included. No further processing would be required.

Code:

\documentclass{article}
\usepackage[demo]{graphicx}% Remove [demo] option in real usage.
\usepackage{letltxmacro}
\usepackage{pgffor}


%% https://tex.stackexchange.com/questions/14393/how-keep-a-running-list-of-strings-and-then-process-them-one-at-a-time
\newcommand\FigList{}
\newcommand\AddFigToList[1]{\edef\FigList{\FigList#1,}}

\LetLtxMacro{\OldIncludegraphics}{\includegraphics}
\renewcommand{\includegraphics}[2][]{%
    \AddFigToList{#2}%
    \OldIncludegraphics[#1]{#2}%
}

\newcommand*{\ShowListOfFigures}{%
    \typeout{Figures included were}%
    \foreach \x in \FigList {%
        %\par\x% <-- uncomment if you want the list in the PDF as well
        \typeout{ \x}
    }%
}
\AtEndDocument{\ShowListOfFigures}

\begin{document}
\includegraphics{images/figA.jpg}

\includegraphics{images/figB.png}
\end{document}

pdflatex provides the flag -recorder, that writes a .fls file. Everything marked INPUT there, are files, that it opened during processing. latexmk uses the flag -deps or -deps-out=FILENAME to show the decencies and in the last case also store those in a make formatted FILENAME.