Skip to content

Modern Fs Exists

Paul Squires edited this page Oct 19, 2026 · 6 revisions

Home › Filesystem › Filesystem Library › Exists

Exists

Returns true if a file or folder is there; false also when access is denied.

Syntax

Exists( p )

Notes

  • boolean

Examples

#import "std/fs"
using fs

dim td as FsResultUStr = CreateTempDir( "fbdoc" )
dim as ustring dir_ = td.Value( )
dim as ustring p = PathJoin( dir_, "f.txt" )
WriteAllText( p, "hello" )

print Exists( p )            '' true
print Exists( dir_ )         '' true -- directories too
print Exists( PathJoin( dir_, "nope" ) )         '' false

'' A boolean, not a Result: "I could not tell" and "it is not there"
'' are the same answer to this question. TryExists is the one that
'' distinguishes them.

RemoveDirAll( dir_ )

Library: Filesystem Library
Category: Filesystem
Documented under: Metadata

Clone this wiki locally