dirExists

dirExists(path$, dirname$) function
Checking the folder for existance. (by the model of fileExists(path$, filename$) function from a helpfile). Based on code by nukesrus21 (Brandon).

code format="lb" dim info$(0, 0) 'as for fileExists function, should be DIMmed before use

'demo to work in JB folder print "DefaultDir$ is ";DefaultDir$ print files DefaultDir$, chr$(0), info$ print "Number of sub-directories: "; info$(0, 1) print "sub-directory list:" for i = 1 to val(info$(0, 0))+val(info$(0, 1)) print info$(i, 0), info$(i, 1), info$(i, 2), info$(i, 3) next print print "Checking for existing folder" print dirExists(DefaultDir$, "SPRITES") print "Checking for non-existing folder" print dirExists(DefaultDir$, "XYZZY")

end

function dirExists(path$, dirname$) files path$, chr$(0), info$  'file name is invalid by design, so we get only folders 'and info$(0,0)) always 0   dirExists = 0    If Val(info$(0,1)) > 0 Then        For i = 1 To Val(info$(0,1))            If info$(i, 1) = dirname$ Then                dirExists = 1                Exit Function            End If        next    end if end function code