August 2011
Intermediate to advanced
552 pages
23h 48m
English
Processing the contents of a directory is a common operation. There are a number of NSFileManager calls, which can process a directory in different ways. Both the path-based and URL-based calls will get you the contents of a directory. The URL-based calls can also prefetch the metadata you want, speeding up the operation.
You can get a flat listing of a directory in an array:
- (NSArray *) contentsOfDirectoryAtPath: (NSString *) path error: (NSError **) error;
This returns an array of file names of all the files in the directory. It is flat because it does not recurse into subdirectories. You can get a deep listing that recurses into subdirectories with this call:
- (NSArray *) subpathsOfDirectoryAtPath ...Read now
Unlock full access