title: Get list of files with specific extensions at a specified path in Objective-C
body: <p>I'm pretty new to Objective-C. I'm developing a Cocoa application.
  Currently I'm looking for the equivalent of this C# code in Objective C:</p>
  
  <pre><code>string[] fileList = Directory.GetFiles(DownloadPath, "*.jpg");
  </code></pre>
  
  <p>The returned strings need not necessarily be full path, since all I need is the file names. I have tried NSFileManager but so far no good yet. Thank you.</p>
  
  <p>EDIT: What I've tried with NSFileManager:</p>
  
  <pre><code>[someFileManager contentsOfDirectoryAtPath:path error:nil];
  </code></pre>
  
  <p>I also want to ask: what is the format of 'path'? This sounds easy, but I'm completely clueless about MAC OS file system. The path that I'm using is from [NSOpenPanel URLs], and they looks like this:</p>
  
  <pre><code>file://localhost/Users/alex/Movies/
  </code></pre>
  
  <p>Sometimes I get the results, but some other time The returned NSArray is just empty. I'm pretty confused about this so any help would be appreciated. </p>
  
  <p>EDIT2:
  The answer here: <a href="https://stackoverflow.com/questions/5032541/nspredicate-endswith-multiple-files">NSPredicate endswith multiple files</a>, is probably a better choice. Nevertheless, thank you for your answer.</p>