Working with Directories

Table 16.2 summarizes some of the methods provided by NSFileManager for working with directories. Many of these methods are the same as those for ordinary files, as listed in Table 16.1.

Image

Table 16.2 Common NSFileManager Directory Methods

Program 16.3 shows basic operations with directories.

Program 16.3

// Some basic directory operations#import <Foundation/Foundation.h>int main (int argc, char * argv[]){  @autoreleasepool {     NSString          *dirName = @"testdir";     NSString          *path;     NSFileManager     *fm;     // Need to create an instance of the file manager     fm = [NSFileManager ...

Get Programming in Objective-C, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.