I want to get all the filenames in my application's documents
folder, and place them in an NSMutableArray
. Nothing more, nothing less.
There is a convenient method in NSFileManager
:
NSFileManager *fileManager = [[NSFileManager alloc] init];
NSArray *files = [fileManager contentsOfDirectoryAtPath:documentsDirectory
error:nil];
...
[fileManager release];
As of ARC you can of course drop the release statement.