title: How to create sub folders under cache of an application using getExternalCacheDir()?
body: <p>In my application I want to save some documents in my application cache. After use I want to clear that files from cache. If I clear the cache all saved data's will be loss but I don't want that. I need to create a sub folder under my cache and I want to read data's from that cache folder also after certain uses I wanted to clear data's present in that particular folder.</p>
  
  <p>How can I do that using <code>getExternalCacheDir()</code>?</p>
  
  <p>I tried using following snippet, </p>
  
  <pre><code>File tempFile = new File(AppDelegate.sharedDelegate().getExternalCacheDir()+"\documentfolder\", name + ext);
  OutputStream outputStream = new FileOutputStream(tempFile);
  IOUtils.copy(inputStream, outputStream);
  outputStream.close();
  return tempFile;
  </code></pre>
  
  <p>But I am getting</p>
  
  <pre><code>System.err: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.package.debug/cache/documentcache/Screenshot_20171108-011217.png.png (No such file or directory)
  W/System.err:     at java.io.FileOutputStream.open(Native Method)
  W/System.err:     at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:221)
  W/System.err:     at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:169)
  </code></pre>
  
  <p>How can I solve it?</p>