title: How to create subfolder using Cordova
body: <p>I'm using Cordova and I tried to create a folder to the root of my SD card on a device. I used the following code for create the folder and add a file 'login.txt' inside it:</p>
  
  <pre><code>window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
  
  function gotFS(fileSystem) {
     fileSystem.root.getDirectory("citylook", {create: true}, gotDir);
  }
  
  function gotDir(dirEntry) {
      dirEntry.getFile("login.txt", {create: true, exclusive: true}, gotFile);
  }
  
  function gotFile(fileEntry) {
      // Do something with fileEntry here
      fileEntry.createWriter(gotFileWriter, fail);
  }
  
  function gotFileWriter(writer) {
      writer.onwriteend = function(evt) {
          console.log("contents of file now 'some sample text'");
          writer.truncate(11);
          writer.onwriteend = function(evt) {
              writer.seek(0);
              writer.write(testo);
              writer.onwriteend = function(evt){
                  console.log("contents of file now '"+testo+"'");
              }
          };
      };
      writer.write("some sample text");
  }
  
  function fail(error) {
      console.log(error.code);
  }
  </code></pre>
  
  <p>Now, I need to create a folder inside "citylook" folder, so I tried this: </p>
  
  <pre><code>function onDeviceReady() {
      window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess, null);
  }
  
  function onSuccess() {
      fileSystem.root.getDirectory("citylook", {create: true, exclusive: false}, onGetDirectoryWin, onGetDirectoryFail);
      fileSystem.root.getDirectory("citylook/nuovo", {create: true, exclusive: false}, onGetDirectoryWin2, onGetDirectoryFail2);
  }
  </code></pre>
  
  <p>but I can't create a subfolder. What's is wrong in my code? Thank you.</p>
  
  <hr>
  
  <h2>SOLVED:</h2>
  
  <pre><code>fileSystem.root.getDirectory("citylook", {create: true}, gotDir);
  fileSystem.root.getDirectory("citylook/subfolder", {create: true}, gotDir);
  </code></pre>