Task

Verify that a file called     input.txt     and   a directory called     docs     exist.



This should be done twice:  

   once for the current working directory,   and
   once for a file and a directory in the filesystem root.


Optional criteria (May 2015):   verify it works with:

   zero-length files
   an unusual filename:     `Abdu'l-Bahá.txt  


 
Module ExistDirAndFile {
      Let WorkingDir$=Dir$, RootDir$="C:\"
 
      task(WorkingDir$)
      task(RootDir$)
      Dir User ' return to user directroy
 
      Sub task(WorkingDir$)
            Local counter
            Dir WorkingDir$
            If Not Exist.Dir("docs") then Report  "docs not exist in "+WorkingDir$ : counter++
            If Not Exist("output.txt") Then {
                  Report "output.txt not exist in "+ WorkingDir$ : counter++
            } Else.if Filelen("output.txt")=0 Then Report "output.txt has zero length"
            If counter =0 then Report  WorkingDir$+ " has docs directory and file output.txt"
      End Sub
}
ExistDirAndFile
 