How to match a file path with a file search pattern (i.e. *.jpg)?
<p>I know how to get all files that match the search pattern in a folder like this:</p>

<pre><code>DirectoryInfo folderInfo = new DirectoryInfo(folderPath);

FileInfo[] fileInfos = folderInfo.GetFiles(searchPattern);
</code></pre>

<p>But my problem is, if I already know the file path, how can I match it with the search pattern? For compatibility, the search pattern has to be the same format like *.jpg or something.</p>
