Provides properties and methods for working with drives, files, and directories.
<HostProtectionAttribute(SecurityAction.LinkDemand, Resources := HostProtectionResource.ExternalProcessMgmt)> _ Public Class FileSystem
Dim instance As FileSystem
[HostProtectionAttribute(SecurityAction.LinkDemand, Resources = HostProtectionResource.ExternalProcessMgmt)] public class FileSystem
[HostProtectionAttribute(SecurityAction::LinkDemand, Resources = HostProtectionResource::ExternalProcessMgmt)] public ref class FileSystem
public class FileSystem
The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: Resources. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.
For more detailed information, see the Visual Basic topic My.Computer.FileSystem Object.
The following table lists examples of tasks involving the My.Computer.FileSystem object.
To
See
Read from a text file
How to: Read From Text Files in Visual Basic
Read from a delimited text file
How to: Read From Comma-Delimited Text Files in Visual Basic
Read from a fixed-width text file
How to: Read From Fixed-width Text Files in Visual Basic
Read from a text file with multiple formats
How to: Read From Text Files with Multiple Formats in Visual Basic
Read from a binary file
How to: Read From Binary Files in Visual Basic
Read from text files in the MyDocuments directory
How to: Read From Existing Text Files in My Documents (Visual Basic)
Read from a text file with a StreamReader
How to: Read Text from Files with a StreamReader (Visual Basic)
Write to a text file
How to: Write Text to Files in Visual Basic
Append to a text file
How to: Append to Text Files in Visual Basic
Write to a binary file
How to: Write to Binary Files in Visual Basic
Write to text files in the MyDocuments directory
How to: Write Text to Files in the My Documents Directory in Visual Basic
Write to a text file with a StreamWriter
How to: Write Text to Files with a StreamWriter in Visual Basic
Copy files with a specific pattern
How to: Copy Files with a Specific Pattern to a Directory in Visual Basic
Copy a file to the same directory
How to: Create a Copy of a File in the Same Directory in Visual Basic
Copy a file to a different directory
How to: Create a Copy of a File in a Different Directory in Visual Basic
Create a file
How to: Create a File in Visual Basic
Delete a file
How to: Delete a File in Visual Basic
Delete all the files in a directory
How to: Delete All Files in a Directory in Visual Basic
Find files with a specific pattern
How to: Find Files with a Specific Pattern in Visual Basic
Move a file
How to: Move a File in Visual Basic
Move a collection of files
How to: Move a Collection of Files in Visual Basic
Rename a file
How to: Rename a File in Visual Basic
Rename a directory
How to: Rename a Directory in Visual Basic
Copy a directory to another directory
How to: Copy a Directory to Another Directory in Visual Basic
Create a directory
How to: Create a Directory in Visual Basic
Delete a directory
How to: Delete a Directory in Visual Basic
Find subdirectories with a specific pattern
How to: Find Subdirectories with a Specific Pattern in Visual Basic
Get the collection of files in a directory
How to: Get the Collection of Files in a Directory in Visual Basic
Determine how many files are in a directory
How to: Determine How Many Files Are in a Directory in Visual Basic
Move a directory
How to: Move a Directory in Visual Basic
Move the contents of a directory
How to: Move the Contents of a Directory in Visual Basic
Read from the MyDocuments directory
How to: Retrieve the Contents of the My Documents Directory in Visual Basic
Parse a file path
How to: Parse File Paths in Visual Basic
This example checks to determine whether the folder C:\backup\logs exists and checks its properties.
Dim logInfo As System.IO.DirectoryInfo If My.Computer.FileSystem.DirectoryExists("C:\backup\logs") Then logInfo = My.Computer.FileSystem.GetDirectoryInfo _ ("C:\backup\logs") End If
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98