Starting with a path to some directory, determine whether the directory is empty.

An empty directory contains no files nor subdirectories.
With Unix or Windows systems, every directory contains an entry for “.” and almost every directory contains “..” (except for a root directory); an empty directory contains no other entries.

      IF FNisdirectoryempty("C:\") PRINT "C:\ is empty" ELSE PRINT "C:\ is not empty"
      IF FNisdirectoryempty("C:\temp") PRINT "C:\temp is empty" ELSE PRINT "C:\temp is not empty"
      END
 
      DEF FNisdirectoryempty(dir$)
      LOCAL dir%, sh%, res%
      DIM dir% LOCAL 317
      IF RIGHT$(dir$)<>"\" dir$ += "\"
      SYS "FindFirstFile", dir$+"*", dir% TO sh%
      IF sh% = -1 ERROR 100, "Directory doesn't exist"
      res% = 1
      REPEAT
        IF $$(dir%+44)<>"." IF $$(dir%+44)<>".." EXIT REPEAT
        SYS "FindNextFile", sh%, dir% TO res%
      UNTIL res% == 0
      SYS "FindClose", sh%
      = (res% == 0)