title: Get array of directories in documents directory
body: <p>I am trying to return the list of directories present in an app's Documents directory. I am able to get an array containing all files of a given extension (eg .txt files or .png files) and am able to return all contents (including directories). The problem arises when I want to return only the directories. Is there a simple way of doing this?</p>
  
  <p>Here is my code for returning all .txt files:</p>
  
  <pre><code>- (ViewController *) init {
      if (self = [super init]) self.title = @"Text Files";
  
      // get the list of .txt files
      directoryList = [[[[NSFileManager defaultManager] directoryContentsAtPath:DOCUMENTS_FOLDER] 
                        pathsMatchingExtensions:[NSArray arrayWithObjects:@".txt", nil]] retain];
      NSLog(@"%@", directoryList);
  
      return self;
  }
  </code></pre>
  
  <p>and for all of the files</p>
  
  <pre><code>- (ViewController *) init {
      if (self = [super init]) self.title = @"Text Files";
  
      // get the list of all files and directories
      directoryList = [[[NSFileManager defaultManager] directoryContentsAtPath:DOCUMENTS_FOLDER] retain];
  
      NSLog(@"%@", directoryList);
  
      return self;
  }
  </code></pre>