title: How to get all folders paths that contains music (mp3) in Cocoa?
body: <p>I'm new in Cocoa.I'm trying to scan computer for music folders,within my application. But I have some logic for it.
  What I need to start scaning from /Users , for example if I have /Users/music/anotherMusic and /Users/music/music2/music3  , I need to be able to get only the top for that folders that contains music (/Users/music ). And also need to continue iterate in subfolders to have a count of music files in the root folder (/Users/music). And so on with the same logic continue scanning whole computer.And results should be displayed in table, for example <strong>RESULTS</strong> should be like this</p>
  
  <p><strong>- -/Users/myComputer/iTunes - 77 folders, 500 music files</strong></p>
  
  <p><strong>- /Users/myComputer/Documents/Music -15 music folders,400 music files</strong></p>
  
  <p><strong>- /Users/myComputer/Downloads/Media -20 music folders, 325 music<br>
     files    (count of all subdirectories with music)</strong></p>
  
  <p>How I can do it? What I did ,it is in the code below. But it's going deep all the way down, and give me each path that contains .mp3 music, but I need logic as mentioned above. </p>
  
  <pre><code>NSFileManager *manager = [NSFileManager defaultManager];
  
         NSDirectoryEnumerator *direnum = [manager enumeratorAtPath:@"/Users/"];                  
          NSString * file;
        while((file=[direnum nextObject]))
        {
            NSString * FullPath=[NSString stringWithFormat:@"/Users/%@",file];
  
            if ([file hasSuffix:@".mp3"])
          { 
            ///gives a music file path that contains mp3, or I can cut last part, and get the folder path. But no logic as should be.
          }
       }
  </code></pre>
  
  <p>Any ideas, or help appreciated. Thanks. </p>