title: Programmatically move files from cache directory to SDCard
body: <p>I'm trying to programmatically move files from the internal memory in Android to a existing directory in the SD card.<br>
  I tried two ways.
  In the first one I used File.renameTo:</p>
  
  <pre><code>String destName = externalDirPath + File.separatorChar + destFileName;
  File originFile = new File(cacheDirPath + File.separatorChar + originalfileName);
  
  originFile.renameTo(new File(destName));
  </code></pre>
  
  <p>In the other I used Runtime.getRuntime():</p>
  
  <pre><code>Process p = Runtime.getRuntime().exec("/system/bin/sh -");
  DataOutputStream os = new DataOutputStream(p.getOutputStream());
  
  String command = "cp " + cacheDirPath + "/" + originalfileName+ " " + externalDirPath + "/" + destFileName+ "\n";
  
  os.writeBytes(command);
  </code></pre>
  
  <p>With both of them it doesn't work..<br><br>
  Any suggestion?</p>