How to find the files in different folders by using php?
<p>I have a question regarding the <code>php</code> file structure.</p>

<p>I want to run a script to genearte images of bunch of <code>pdf</code> files.</p>

<p>My problem is the actually <code>pdf</code> files are in different folders and structures.</p>

<p>For example:</p>

<p>a pdf could locate in</p>

<pre><code>/test/book/pdf/test.pdf.
</code></pre>

<p>another one could be in</p>

<pre><code>/server/pdfs/link/dummy.pdf.
</code></pre>

<p>There are thousands of <code>pdfs</code> file in the file system and I am using <code>Imagick</code> to generate the images from <code>pdfs</code>.</p>

<p>I am not sure how to locate all of the <code>pdf</code> nor how to specify the file path in <code>imagick</code> constructor.</p>

<pre><code> $im = new imagick('file path to pdf here');  //I don't know how to specify the file path here...
 $im-&gt;setImageFormat( "jpg" );
</code></pre>

<p>Can anyone gives me a hint? Thanks so much!</p>
