home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_BAS / PRO98SRC.ZIP / DIREXIST.BAS < prev    next >
BASIC Source File  |  1994-01-14  |  590b  |  25 lines

  1. FUNCTION DirExist%(byval Spec$)
  2. DirSpec$=Spec$
  3. IF (DirSpec$="\") OR _
  4.    (LEN(DirSpec$)=3 AND _
  5.     MID$(DirSpec$,2,1)=":" AND _
  6.     RIGHT$(DirSpec$,1)="\") THEN
  7.    DirExist%=-1
  8. ELSE
  9.    IF RIGHT$(DirSpec$,1)="\" THEN
  10.       DirSpec$ = LEFT$(DirSpec$,LEN(DirSpec$)-1)
  11.    END IF
  12.    F$ = DIR$(DirSpec$,0)
  13.    IF F$="" THEN
  14.       F$ = DIR$(DirSpec$,16)
  15.       If F$="" then
  16.          DirExist%=0     'Doesnt exist
  17.       ELSE
  18.          DirExist%=-1    'It does exist
  19.       END IF
  20.    ELSE
  21.       DirExist%=0         'Its a file, not a subdirectory
  22.    END IF
  23. END IF
  24. END FUNCTION
  25.