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:

string[] fileList = Directory.GetFiles(DownloadPath, "*.jpg");

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.

EDIT: What I've tried with NSFileManager:

[someFileManager contentsOfDirectoryAtPath:path error:nil];

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:

file://localhost/Users/alex/Movies/

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.

EDIT2: The answer here: NSPredicate endswith multiple files, is probably a better choice. Nevertheless, thank you for your answer.

Edit
Report