title: Copying from asset to sdcard open failed: ENOENT (No such file or directory)
body: <p>I am try to copy from asset to sdcard
  Here is part of my code</p>
  
  <pre><code>private void CopyAssets(String folder) {
  
          File folders = new File(Environment.getExternalStorageDirectory().toString()+"/beatscache/"+folder);
          folders.mkdirs();
          AssetManager assetManager = getAssets();
          String[] files = null;
                  try {
              files = assetManager.list(folder);
          } catch (IOException e) {
              Log.e("tag", e.getMessage());
          }
  
          for(String filename : files) {
              InputStream in = null;
              OutputStream out = null;
              try {
                in = assetManager.open(folder+"/"+filename);   // if files resides inside the "Files" directory itself
                out = new FileOutputStream(Environment.getExternalStorageDirectory().toString()+"/"+"beatscache"+"/"+folder +"/" + filename);
                copyFile(in, out);
                in.close();
                in = null;
                out.flush();
                out.close();
                out = null;
              } catch(Exception e) {
                  Log.e("tag", e.getMessage());
              }
          }
      }
      private void copyFile(InputStream in, OutputStream out) throws IOException {
          byte[] buffer = new byte[1024];
          int read;
          while((read = in.read(buffer)) != -1){
            out.write(buffer, 0, read);
          }
      }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>CopyAssets("bin");
  </code></pre>
  
  <p>Log shows</p>
  
  <blockquote>
    <p>E/tag(3801): /mnt/sdcard/beatscache/bin/alsa_ctl: open failed: ENOENT
    (No such file or directory)</p>
  </blockquote>
  
  <p>I have given READ and WRITE permissions in AndroidManifest.xml
  and checked Environment.MEDIA_MOUNTED.equals(state) returns true.</p>
  
  <p>And folder is not getting created.</p>
  
  <p>Can you tell where I am doing wrong.?</p>