1 (edited by Luzie 2023-04-13 15:54:08)

Topic: Request for a DOT-Command to report if file or directory exist

Here´s my request for a DOT-Command e.g. called ".ifexist" to report if file or directory exists.

I need it under NextBASIC, and there´s no BASIC built-in command for doing this query from NextBASIC yet.

Thank you!

2

Re: Request for a DOT-Command to report if file or directory exist

I'm fairly sure Garry's version of 128 BASIC has some kind of error handling equivalent to ON ERROR that you could use for that purpose.

3

Re: Request for a DOT-Command to report if file or directory exist

aowen wrote:

I'm fairly sure Garry's version of 128 BASIC has some kind of error handling equivalent to ON ERROR that you could use for that purpose.

Thank you. Someone tells me a way in NextBASIC (using ON ERROR) to check for existance of a file or directory.

4 (edited by aowen 2023-07-24 16:54:44)

Re: Request for a DOT-Command to report if file or directory exist

Luzie wrote:
aowen wrote:

I'm fairly sure Garry's version of 128 BASIC has some kind of error handling equivalent to ON ERROR that you could use for that purpose.

Thank you. Someone tells me a way in NextBASIC (using ON ERROR) to check for existance of a file or directory.

Sorry no-one has got back to you on this. Here's how I'd do it in SE Basic IV.

10 EXISTS = 1
20 FOLDER$ = "FOLDER"
30 ON ERROR GOSUB 100
40 CHDIR FOLDER$
50 IF EXISTS = 1 THEN PRINT "Folder exists": ELSE PRINT "Folder does not exist"
60 END
100 ON ERROR STOP
110 EXISTS = 0
120 RETURN