title: Delete empty folders in iOS?
body: <p>I have plenty of empty temporary folders in app's Document folder.</p>
  
  <p>How to delete them all?</p>
  
  <p>I tried:</p>
  
  <pre><code>NSArray *folders = [[NSFileManager defaultManager]contentsOfDirectoryAtURL:[self applicationDocumentsDirectory] includingPropertiesForKeys:[NSArray arrayWithObject:@"NSURLIsDirectoryKey"] options:0 error:nil];
  if (folders) {
      for (NSURL *url in folders) {
          [[NSFileManager defaultManager]removeItemAtURL:url error:nil];
      }
  }
  </code></pre>
  
  <p>but it deletes all, not only folders</p>