title: Renaming successive folders and files in android
body: <p>I have a file at location a/b/c.txt . I want to move this file to location d/e/f.txt .I want to rename the folder/directory a to d ,b to e and file c.txt to f.txt .How to do this in android?</p>
  
  <pre><code>public void moveFile(View view) {
              File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "a" + File.separator + "b" + File.separator + "c.txt");
              if (file.exists()) {
                  boolean res = file.renameTo(new File(Environment.getExternalStorageDirectory().getAbsoluteFile() + File.separator + "d" + File.separator + "e" + File.separator + "f.txt"));
  
  
                  Toast.makeText(MainActivity.this, String.valueOf(res), Toast.LENGTH_SHORT).show();
              }
  
          }
  </code></pre>