Task

Rename:

   a file called     input.txt     into     output.txt     and 
   a directory called     docs     into     mydocs.


This should be done twice:  
once "here", i.e. in the current working directory and once in the filesystem root.

It can be assumed that the user has the rights to do so.

(In unix-type systems, only the user root would have
sufficient permissions in the filesystem root.)




void setup(){
  boolean sketchfile = rename(sketchPath("input.txt"), sketchPath("output.txt"));
  boolean sketchfold = rename(sketchPath("docs"), sketchPath("mydocs"));
  // sketches will seldom have write permission to root files/folders
  boolean rootfile = rename("input.txt", "output.txt");
  boolean rootfold = rename("docs", "mydocs");
  // true if succeeded, false if failed
  println(sketchfile, sketchfold, rootfile, rootfold);  
}
 
boolean rename(String oldname, String newname) {
  // File (or directory) with old name
  File file = new File(oldname);
  // File (or directory) with new name
  File file2 = new File(newname);
  // Rename file (or directory)
  boolean success = file.renameTo(file2);
  return success;
}