I have the following code:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
However I am clueless as to how to get all the files names and assign them to an array?
Any help would be appreciated.
NSFileManager has a method called
contentsOfDirectoryAtPath:error:that returns an array of all the files in that directory.You can use it like this:
The
documentsArrayobject will contain a list of all the files in that directory.