Dilshan
Dilshan

Reputation: 3221

Loading images list from sub directories of document directory

I have set of images in iphone document directory,

Eg:

document_directory/sub_directory_1/sub directory_2

So how to retrieve all images from sub directory_2 as a NSArray or some sort of a data structure.

Thank you

Upvotes: 0

Views: 492

Answers (1)

d11wtq
d11wtq

Reputation: 35318

Assuming you have the path as a NSString*, use NSFileManager

NSFileManager *fileManager = [NSFileManager defaultManager];
for (NSString *fileName in [fileManager contentsOfDirectoryAtPath:directoryPath error:NULL]) {
  NSLog(@"Found file %@", fileName);
}

Upvotes: 3

Related Questions