title: iOS list existing directories
body: <p>I already get path for documents directory and create some directories inside. I already know how to check if directory exist, delete it or its files but, how could I list directories? Thank you.</p>
  
  <p>for file listing I use:</p>
  
  <pre><code>int Count;
      NSString *path;
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"SomeDirectoryName"];
      NSArray *directoryContent = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:NULL];
      for (Count = 0; Count &lt; (int)[directoryContent count]; Count++)
      {
          NSLog(@"File %d: %@", (Count + 1), [directoryContent objectAtIndex:Count]);
      }
  </code></pre>