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




/* File rename, in jsish */
try { File.rename('input.txt', 'output.txt', false); } catch (str) { puts(str); }
 
exec('touch input.txt');
puts("overwrite set true if output.txt exists");
File.rename('input.txt', 'output.txt', true);
 
try { File.rename('docs', 'mydocs', false); } catch (str) { puts(str); }
try { File.rename('/docs', '/mydocs', false); } catch (str) { puts(str); }