Skip to Content
VB.NET Language in a Nutshell, Second Edition
book

VB.NET Language in a Nutshell, Second Edition

by Steven Roman PhD, Ron Petrusha, Paul Lomax
April 2002
Intermediate to advanced
688 pages
19h 51m
English
O'Reilly Media, Inc.
Content preview from VB.NET Language in a Nutshell, Second Edition

Name

Directory.CreateDirectory Method

Class

System.IO.Directory

Syntax

Directory.CreateDirectory(path)
path (required; String)

The path of the new directory

Return Value

None

Description

Creates a new directory

Rules at a Glance

  • path must represent a legal path.

  • path can be an absolute or a relative path. For example:

    Directory.CreateDirectory("C:\Temp")

    specifies an absolute path (it begins with a drive’s root directory), while:

    Directory.CreateDirectory("..\Chapter2")

    is a relative path that begins from the current directory. Relative paths can make use of the “.” and “..” characters, which represent the current directory and the parent of the current directory, respectively.

  • The CreateDirectory method creates all directories required to create a specified path. For example, the code:

    Directory.CreateDirectory("c:\NewDirectory\NewSubDirectory")

    will create the NewDirectory folder if it does not exist and then the newSubDirectory folder if it does not exist.

  • path can be either a path on the local system, the path of a mapped network drive, or a UNC path.

Programming Tips and Gotchas

The CreateDirectory method does not raise an error if the directory to be created already exists.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VB .NET Language in a Nutshell

VB .NET Language in a Nutshell

Steven Roman PhD, Ron Petrusha, Paul Lomax

Publisher Resources

ISBN: 0596003080Supplemental ContentCatalog PageErrata