FileSystem.RmDir(String) 方法

定義

移除現有的目錄。 這個 My 功能能讓你在檔案 I/O 操作 RmDir中提升生產力和效能。 如需詳細資訊,請參閱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

必須的。 一個字串表達式,用來識別要移除的目錄或資料夾。 Path 可以包含駕駛。 若未指定磁碟機,則 RmDir 移除當前磁碟上的目錄。

例外狀況

Path 未指定或為空。

目標目錄包含檔案。

目錄不存在。

範例

這個範例使用 RmDir 了移除現有目錄的函式。

' Assume that MYDIR is an empty directory.
' Remove MYDIR.
RmDir("MYDIR")

備註

如果你嘗試在包含檔案的目錄中使用 , RmDir 就會發生錯誤。 在嘗試移除目錄之前,先用刪除 Kill 所有檔案的功能。

適用於

另請參閱