O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

File.Exists Method

Class

System.IO.File

Syntax

File.Exists(path)
path (required; String)

The file path

Return Value

A Boolean indicating whether the file exists

Description

Indicates whether a file exists

Rules at a Glance

  • path is a fully qualified filename or a relative path (which is interpreted as starting in the current directory).

  • The Exists method returns True only if the specified file exists; otherwise, it returns False. Note that Exists returns False if path describes a directory instead of a folder.

Programming Tips and Gotchas

Since the File class is shared, you don’t have to instantiate any objects before calling the File.Exists method.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required