My.Computer.FileSystem Object Members

The My.Computer.FileSystem Object provides properties and methods for working with drives, files, and directories.

Properties

Property

Description

CurrentDirectory

Gets the current directory.

Drives

Gets information about drives.

SpecialDirectories

Returns the My.Computer.FileSystem.SpecialDirectories Object, which can be used to access special directories, such as Temp or MyDocuments.

Methods

Method

Description

CombinePath

Returns a correctly formatted combined path as a String.

CopyDirectory

Copies a directory.

CopyFile

Copies a file.

CreateDirectory

Creates a directory.

DeleteDirectory

Deletes a directory.

DeleteFile

Deletes a file.

DirectoryExists

Returns a Boolean indicating whether a directory exists.

FileExists

Returns a Boolean indicating whether a file exists.

My.Computer.FileSystem.FindInFiles Method

Returns a read-only collection of strings that represent the names of files that contains the specified text.

GetDirectories

Returns a String collection representing the path names of subdirectories in a directory.

GetDirectoryInfo

Returns a DirectoryInfo object for the specified path.

GetDriveInfo

Returns a DriveInfo object for the specified path.

GetFileInfo

Returns a FileInfo object for the specified path.

GetFiles

Returns a read-only String collection representing the names of files in a directory.

GetParentPath

Returns a String representing the absolute path of the parent of the provided path.

MoveDirectory

Moves a directory.

MoveFile

Moves a file.

OpenTextFieldParser

Opens a TextFieldParser.

OpenTextFileReader

Opens a TextReader.

OpenTextFileWriter

Opens a TextWriter.

ReadAllBytes

Reads from a binary file.

ReadAllText

Reads from a text file.

RenameDirectory

Renames a directory.

RenameFile

Renames a file.

WriteAllBytes

Writes to a binary file.

WriteAllText

Writes to a text file.

See Also

Tasks

Walkthrough: Manipulating Files and Directories in Visual Basic

Concepts

Parsing Text Files with the TextFieldParser Object

Reference

My.Computer.FileSystem Object

Other Resources

Reading from Files in Visual Basic

Writing to Files in Visual Basic

Creating, Deleting, and Moving Files and Directories in Visual Basic

File, Directory, and Drive Properties in Visual Basic