创建、删除和移动文件和目录 (Visual Basic)Creating, Deleting, and Moving Files and Directories in Visual Basic

本节列出了与在 Visual Basic 中创建、删除、移动和重命名文件及目录相关的任务。This section lists tasks associated with creating, deleting, moving, and renaming files and directories in Visual Basic.

本节内容In This Section

如何:将具有特定模式的文件复制到目录中How to: Copy Files with a Specific Pattern to a Directory
演示如何将具有特定文件名模式的文件(例如仅 .txt 文件)复制到目录。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
演示如何使用 My 方法合并文件路径。Demonstrates how to use My methods to combine file paths.

引用Reference

FileSystem
介绍 My.Computer.FileSystem 对象及其成员。Describes the My.Computer.FileSystem object and its members.

CombinePath
介绍 CombinePath 方法。Describes the CombinePath method.

CopyDirectory
介绍 CopyDirectory 方法。Describes the CopyDirectory method.

CopyFile
介绍 CopyFile 方法。Describes the CopyFile method.

CreateDirectory
介绍 CreateDirectory 方法。Describes the CreateDirectory method.

DeleteDirectory
介绍 DeleteDirectory 方法。Describes the DeleteDirectory method.

DeleteFile
介绍 DeleteFile 方法。Describes the DeleteFile method.

GetParentPath
介绍 GetParentPath 方法。Describes the GetParentPath method.

MoveDirectory
介绍 MoveDirectory 方法。Describes the MoveDirectory method.

MoveFile
介绍 MoveFile 方法。Describes the MoveFile method.

RenameDirectory
介绍 RenameDirectory 方法。Describes the RenameDirectory method.

RenameFile
介绍 RenameFile 方法。Describes the RenameFile method.

SpecialDirectories
描述 SpecialDirectories 对象。Describes the SpecialDirectories object.

从文件读取Reading from Files
列出与读取文件相关的任务。Lists tasks associated with reading from files.

写入文件Writing to Files
列出涉及写入文件的任务。Lists tasks involving writing to files.