FileSystem.RmDir(String) 方法
定义
移除现有目录。Removes an existing directory. 相比 RmDir,My 功能可使文件 I/O 操作的效率更高、性能更好。The My feature gives you better productivity and performance in file I/O operations than RmDir. 有关详细信息,请参阅 DeleteDirectory。For more information, see DeleteDirectory.
public:
static void RmDir(System::String ^ Path);
public static void RmDir (string Path);
static member RmDir : string -> unit
Public Sub RmDir (Path As String)
参数
- Path
- String
必需。Required. 标识要移除的目录或文件夹的字符串表达式。A string expression that identifies the directory or folder to be removed. Path 可以包含驱动器。Path can include the drive. 如果未指定驱动器,则 RmDir 移除当前驱动器上的目录。If no drive is specified, RmDir removes the directory on the current drive.
例外
Path 未指定或为空。Path is not specified or is empty.
目标目录包含文件。Target directory contains files.
目录不存在。Directory does not exist.
示例
此示例使用 RmDir 函数来删除现有目录。This example uses the RmDir function to remove an existing directory.
' Assume that MYDIR is an empty directory.
' Remove MYDIR.
RmDir("MYDIR")
注解
如果尝试对 RmDir 包含文件的目录使用,则会出现错误。An error occurs if you try to use RmDir on a directory that contains files. 在 Kill 尝试删除目录之前,请使用函数删除所有文件。Use the Kill function to delete all files before you try to remove a directory.