IOS中文件目录递归

-(void) r:(NSString*) path{
    BOOL isDir;
    [self.fm fileExistsAtPath:path isDirectory:&isDir];
    if (isDir) {
        NSLog(@"文件夹:%@",path);
        NSArray* files = [self.fm contentsOfDirectoryAtPath:path error:nil];
        for (NSString* file in files) {
            [self r:[path stringByAppendingPathComponent:file]];
        }
    }else{
        NSLog(@"文件:%@",path);
    }
}

你可能感兴趣的:(ios,递归,iPhone,文件)