 CLS
 PRINT "This program will comapare a given MAPLIST to a given DIRECTORY.  It"
 PRINT "will identify any maps that are NOT in the directory. or alternatively"
 PRINT "it will identify maps in the DIRECTORY that are not in the MAPLIST."
 PRINT

 x = 2000
 DIM MAP$(x), MListed$(x)

 MapPath$ = "\APRS\MAPS"
      PRINT "Enter path to the MAP DIRECTORY to scan";
      INPUT a$: IF a$ <> "" THEN MapPath$ = UCASE$(a$)
      PRINT "Enter path/filename of MAPLIST to compare";
      INPUT a$: IF a$ <> "" THEN Maplist$ = UCASE$(a$) ELSE Maplist$ = "MAPLIST.USA"
      SHELL "dir " + MapPath$ + " >temp.txt"

     OPEN "temp.txt" FOR INPUT AS #1
     OPEN Maplist$ FOR INPUT AS #2
     PRINT
     PRINT "The following MAPS are in "; MapPath$; ":"
     DO UNTIL EOF(1)
        LINE INPUT #1, a$: REM PRINT a$
        IF LEN(a$) > 38 AND LEFT$(a$, 1) <> "." AND LEFT$(a$, 1) <> " " THEN
           MapName$ = LEFT$(a$, 12)
           IF RIGHT$(MapName$, 3) = "MAP" THEN
              nmp = nmp + 1
              MAP$(nmp) = RTRIM$(LEFT$(MapName$, 8))
              PRINT LEFT$(MAP$(nmp) + "          ", 10);
           END IF
        END IF 'if it was a valid file name
     LOOP 'to the next MAP file
     CLOSE #1 ' Finished that all files in that directory
     PRINT
     INPUT "Hit ENTER to proceed..."; a$
     PRINT
     PRINT "The following map filenames are listed in "; Maplist$; ":"
     FOR i = 1 TO 5: LINE INPUT #2, a$: NEXT
     DO UNTIL EOF(2)
        LINE INPUT #2, a$
        IF LEFT$(a$, 1) <> "*" THEN
           a = INSTR(UCASE$(a$), "MAP")
           IF a > 2 AND a < 11 THEN
              nil = nil + 1
              MListed$(nil) = RTRIM$(UCASE$(LEFT$(a$, a - 2)))
              PRINT LEFT$(MListed$(nil) + "          ", 10);
           END IF
        END IF
     LOOP
     CLOSE #2
     PRINT
     INPUT "Hit ENTER to proceed..."; a$
     PRINT
     PRINT "The following MAPS are listed in "; Maplist$; ","
     PRINT "but are not found in "; MapPath$; ":"
     FOR i = 1 TO nil
         OK = 0
         FOR j = 1 TO nmp
             IF MAP$(j) = MListed$(i) THEN OK = -1: j = nmp
         NEXT
         IF OK = 0 THEN PRINT LEFT$(MListed$(i) + "          ", 10);
     NEXT i
     PRINT
     INPUT "Hit ENTER to proceed..."; a$
     PRINT
     PRINT "The following MAP files in "; MapPath$; ","
     PRINT "were not listed in "; Maplist$; ":"
     PRINT
     FOR i = 1 TO nmp
         OK = 0
         FOR j = 1 TO nil
             IF MListed$(j) = MAP$(i) THEN OK = -1: j = nil
         NEXT
         IF OK = 0 THEN PRINT LEFT$(MAP$(i) + "          ", 10);
     NEXT i
     PRINT
END

