NSDirectoryEnumerator* e = [[NSFileManager defaultManager] enumeratorAtPath:MMDocumentsFolder()];
// Ignore any files except XYZ.jpg
for (NSString* file in e)
{
if (NSOrderedSame == [[file pathExtension] caseInsensitiveCompare:@"jpg"])
{
// Do something with file.jpg
}
else
if ([[[e fileAttributes] fileType] isEqualToString:NSFileTypeDirectory])
{
// Ignore any subdirectories
[e skipDescendents];
}
}
- (void)viewWillAppear{
NSString *file;
NSString *docsDir = [NSHomeDirectory() stringByAppendingPathComponent: @"Documents"];
NSDirectoryEnumerator *dirEnum =
[[NSFileManager defaultManager] enumeratorAtPath:docsDir];
while (file = [dirEnum nextObject]) {
if ([[file pathExtension] isEqualToString: @"doc"]) {
[self scanDocument: [docsDir stringByAppendingPathComponent:file]];
}
}
}
@end
@interface ManageViewController : UITableViewController {
}
@end