Count files in directories AND subdirectories? iPhone

Posted by AWright4911 on Stack Overflow See other posts from Stack Overflow or by AWright4911
Published on 2010-05-14T23:53:30Z Indexed on 2010/05/14 23:54 UTC
Read the original article Hit count: 253

I am trying to count entire files in a directory, including subdirectories. This is what I have to count files in the first folder:

-(NSString *)numberOfPhotos
{
    NSString *MyPath = @"/rootdirectory/"; 
    NSArray *directoryContent = [[NSFileManager defaultManager] directoryContentsAtPath:MyPath]; 

    return [NSString stringWithFormat:@"%d", [directoryContent count]];
}

I was thinking maybe something like

for (file in folder){
    [file count]
{

but doesnt seem to work.

© Stack Overflow or respective owner

Related posts about file

Related posts about count