My.Computer.FileSystem ObjectÂ
Provides properties and methods for working with drives, files, and directories.
Tasks
The following table lists examples of tasks involving the My.Computer.FileSystem object.
To | See |
---|---|
Read from a text file |
|
Read from a delimited text file |
How to: Read From Comma-Delimited Text Files in Visual Basic |
Read from a fixed-width text file |
|
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 |
|
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 |
|
Append to a text file |
|
Write to a binary file |
|
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 |
|
Delete a file |
|
Delete all the files in a directory |
|
Find files with a specific pattern |
|
Move a file |
|
Move a collection of files |
|
Rename a file |
|
Rename a directory |
|
Copy a directory to another directory |
How to: Copy a Directory to Another Directory in Visual Basic |
Create a directory |
|
Delete a directory |
|
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 |
|
Move the contents of a directory |
|
Read from the MyDocuments directory |
How to: Retrieve the Contents of the My Documents Directory in Visual Basic |
Parse a file path |
Example
This example checks to determine whether the folderC:\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
Requirements
Namespace: Microsoft.VisualBasic.MyServices
Class: FileSystemProxy (provides access to FileSystem)
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
See Also
Reference
My.Computer.FileSystem Object Members
My.Computer.FileSystem.SpecialDirectories Object
My.Computer Object
Microsoft.VisualBasic.FileIO.FileSystem