title: Creating a file as root in android
body: <p>I'm trying to write a little App to restore some data.<br/>
  Of course the phone is rooted and the emulator, too...</p>
  
  <p>So, I have a ZIP-file with some directories. I want to recreate the directories and files, using a Process-Session started with "su".</p>
  
  <p>I create the directories with "mkdir /data/...". No problem!</p>
  
  <p>Now I want to create the files. I know, that I can create a file under Linux with "cat > /path/to/file", then sending data and closing all with "CTRL+D", so I wanted to do that in the App, too.</p>
  
  <p>Hier my code:</p>
  
  <pre><code>      dos.writeBytes("cat &gt; /tmp/x/mybackup/" + ze.getName() + "\n");
        while((byteCount = this.zis.read(buffer)) != -1)
        {
          dos.write(buffer, 0, byteCount);
        }
        dos.write(4); // CTRL+d
        dos.flush();
  </code></pre>
  
  <p>Well, I can create the file, but just <strong>one</strong> file, and the content is the concatenated content of all file, that I extract from ZIP...<br/>
  It seems, that my "CTRL+D" will be ignored.</p>
  
  <p>Could you help me and say what I'm doing wrong? Or suggest a better solutions...</p>
  
  <p>Thanks a lot
  Luca</p>