Check that file exists: Difference between revisions

Add BaCon
(Add BaCon)
Line 313:
RETURN
</lang>
 
==={{header|BaCon}}===
<lang freebasic>' File exists
f$ = "input.txt"
d$ = "docs"
IF FILEEXISTS(f$) THEN PRINT f$, " exists"
IF FILEEXISTS(d$) AND FILETYPE(d$) = 2 THEN PRINT d$, " directory exists"
 
f$ = "/" & f$
d$ = "/" & d$
PRINT f$, IIF$(FILEEXISTS(f$), " exists", " does not exist")
PRINT d$, IIF$(FILEEXISTS(d$) AND FILETYPE(d$) = 2, " is", " is not"), " a directory"
 
f$ = "empty.bac"
PRINT f$, IIF$(FILEEXISTS(f$), " exists", " does not exist")
 
f$ = "`Abdu'l-Bahá.txt"
PRINT f$, IIF$(FILEEXISTS(f$), " exists", " does not exist")</lang>
 
{{out}}
<pre>prompt$ ./fileexits
/input.txt does not exist
/docs is not a directory
empty.bac exists
`Abdu'l-Bahá.txt does not exist</pre>
 
 
=={{header|Batch File}}==
Anonymous user