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

 

Updated: July 20, 2015

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

This section lists tasks associated with creating, deleting, moving, and renaming files and directories in Visual Basic.

How to: Copy Files with a Specific Pattern to a Directory
Demonstrates how to copy files with a specific file name pattern, such as only .txt files, to a directory.

How to: Create a Copy of a File in the Same Directory
Demonstrates how to create a copy of a file in the same directory.

How to: Create a Copy of a File in a Different Directory
Demonstrates how to copy a file to another directory.

How to: Create a File
Demonstrates how to create a file.

How to: Delete a File
Demonstrates how to delete a file.

How to: Find Files with a Specific Pattern
Demonstrates how to list only files with a specific file name pattern in a directory.

How to: Move a File
Demonstrates how to move a file to a different directory.

How to: Rename a File
Demonstrates how to rename a file.

How to: Copy a Directory to Another Directory
Demonstrates how to copy a directory to another location.

How to: Create a Directory
Demonstrates how to create a directory.

How to: Find Subdirectories with a Specific Pattern
Demonstrates how to list directories with a specific pattern in their name.

How to: Get the Collection of Files in a Directory
Demonstrates how to list the files in a directory.

How to: Retrieve the Contents of the My Documents Directory
Demonstrates how to read from special directories.

How to: Parse File Paths
Demonstrates how to use My methods to combine file paths.

FileSystem
Describes the My.Computer.FileSystem object and its members.

CombinePath
Describes the CombinePath method.

CopyDirectory
Describes the CopyDirectory method.

CopyFile
Describes the CopyFile method.

CreateDirectory
Describes the CreateDirectory method.

DeleteDirectory
Describes the DeleteDirectory method.

DeleteFile
Describes the DeleteFile method.

GetParentPath
Describes the GetParentPath method.

MoveDirectory
Describes the MoveDirectory method.

MoveFile
Describes the MoveFile method.

RenameDirectory
Describes the RenameDirectory method.

RenameFile
Describes the RenameFile method.

SpecialDirectories
Describes the SpecialDirectories object.

Reading from Files
Lists tasks associated with reading from files.

Writing to Files
Lists tasks involving writing to files.

Show: