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.)




import scala.language.implicitConversions
import java.io.File
 
object Rename0 {
  def main(args: Array[String]) {              // The implicit causes every String to File mapping,
    implicit def file(s: String) = new File(s) // will be converted to new File(String)
    "myfile.txt" renameTo "anotherfile.txt"
    "/tmp/myfile.txt" renameTo "/tmp/anotherfile.txt"
    "mydir" renameTo "anotherdir"
    "/tmp/mydir" renameTo "/tmp/anotherdir"
  }
}