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.
UPDATE: Actually, was very easy:
NSDirectoryEnumerator *subs = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:musicPath error:nil];