Partager via


My.Computer.FileSystem.CreateDirectory Method 

Creates a directory.

' Usage
My.Computer.FileSystem.CreateDirectory(directory)
' Declaration
Public Sub CreateDirectory( _
   ByVal directory As String _
)

Parameters

  • directory
    String. Name and location of the directory. Required.

Exceptions

The following conditions may cause an exception:

Remarks

If the directory already exists, no exception is thrown.

Tasks

The following table lists examples of tasks involving the My.Computer.FileSystem.CreateDirectory method.

To See

Create a directory

How to: Create a Directory in Visual Basic

Example

This example creates the directory, NewDirectory, in C:\Documents and Settings\All Users\Documents.

My.Computer.FileSystem.CreateDirectory _
("C:\Documents and Settings\All Users\Documents\NewDirectory")

Requirements

Namespace: Microsoft.VisualBasic.MyServices

Class: FileSystemProxy (provides access to FileSystem)

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Availability by Project Type

Project type Available

Windows Application

Yes

Class Library

Yes

Console Application

Yes

Windows Control Library

Yes

Web Control Library

Yes

Windows Service

Yes

Web Site

Yes

Permissions

The following permission may be necessary:

Permission Description

FileIOPermission

Controls the ability to access files and folders. Associated enumeration: Unrestricted.

For more information, see Code Access Security and Requesting Permissions.

See Also

Tasks

How to: Determine if a Directory Exists in Visual Basic

Reference

My.Computer.FileSystem Object
CreateDirectory