I have a document that is constructed from a number of *.tex files stored in a directory organized as follows:
-2022
-07
-01
-note.tex
-file1.pdf
-differentfilename.pdf
-02
-note.tex
-05
-note.tex
-somefile.pdf
-anotherfile.pdf
etc.
My "master" LaTeX document loops through all of the date folders and includes the note.tex into the document. I'd like to include the various pdf files as links to open in the system reader if they are present on a given day. Is there a way I can get LaTeX to loop through the file structure and include pdf's as appropriate? My MWE attempt is as follows:
% !TEX options=--shell-escape
\documentclass{article}
\usepackage[letterpaper,margin=1.25in,top=1in,bottom=1in]{geometry}
\usepackage{pgfcalendar}
\let\d=\pgfcalendarshorthand
\newcommand\formatdate[2]{\pgfcalendar{cal}{#1}{#1}{#2}}
\newcommand\firstdate{2022-07-01}
\newcommand\lastdate{\year-\month-\day}
\begin{document}
\pgfcalendar{cal}{\firstdate}{\lastdate}{%
\def\formatteddate{\d{y}0/\d{m}0/\d{d}0}%
\graphicspath{ {./\formatteddate/}}
\IfFileExists{./\formatteddate/note.tex}{
\marginpar{\vspace*{1em}\textsf{ \d m. \d d- \d y- }}%
\vspace*{1.5em}
\addcontentsline{toc}{section}{\d mt \d d0, \d y0}%
\input{./\formatteddate/note.tex}
\begin{flushright}
HERE IS WHERE I'D LIKE SOME COMMAND THAT CAN FIND ANY PDFS IN THE DAY'S FOLDER AND INCLUDE A LINK TO THEM IF POSSIBLE.
\end{flushright}
}{}
}
\end{document}
I guess it's fairly easy to do this if the file names followed some convention, but in my case they do not, so I'd like to identify them by the .pdf extension and include links to any such files. Thank you!