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




INCLUDE "D2:IO.ACT" ;from the Action! Tool Kit
 
PROC Dir(CHAR ARRAY filter)
  BYTE dev=[1]
  CHAR ARRAY line(255)
 
  Close(dev)
  Open(dev,filter,6)
  DO
    InputSD(dev,line)
    PrintE(line)
    IF line(0)=0 THEN
      EXIT
    FI
  OD
  Close(dev)
RETURN
 
PROC Main()
  CHAR ARRAY filter="D:*.*",
    cmd="D:INPUT.TXT OUTPUT.TXT"
 
  Put(125) PutE() ;clear screen
 
  PrintF("Dir ""%S""%E",filter)
  Dir(filter)
 
  PrintF("Rename ""%S""%E%E",cmd)
  Rename(cmd)
 
  PrintF("Dir ""%S""%E",filter)
  Dir(filter)
RETURN