FileSystem.RmDir 方法
移除現有的目錄。My 功能提供比 RmDir 更強的檔案 I/O 作業產能和效能。如需詳細資訊,請參閱 My.Computer.FileSystem.DeleteDirectory 方法。
命名空間: Microsoft.VisualBasic
組件: Microsoft.VisualBasic (在 microsoft.visualbasic.dll 中)
語法
'宣告
Public Shared Sub RmDir ( _
Path As String _
)
'用途
Dim Path As String
FileSystem.RmDir(Path)
public static void RmDir (
string Path
)
public:
static void RmDir (
String^ Path
)
public static void RmDir (
String Path
)
public static function RmDir (
Path : String
)
參數
- Path
必要項。String 運算式,可識別要移除的目錄或資料夾;Path 可包括磁碟機。如果未指定磁碟機,則 RmDir 會移除目前磁碟機上的目錄。
備註
如需詳細資訊,請參閱 Visual Basic 的主題 RmDir 函式。
如果您嘗試在包含檔案的目錄上使用 RmDir,將會發生錯誤。使用 Kill 函式來刪除所有檔案之後,再嘗試移除目錄。
範例
此範例使用 RmDir 函式來移除現有的目錄。
' Assume that MYDIR is an empty directory.
' Remove MYDIR.
RmDir("MYDIR")
平台
Windows 98、 Windows 2000 SP4、 Windows Millennium Edition、 Windows Server 2003、 Windows XP Media Center Edition、 Windows XP Professional x64 Edition、 Windows XP SP2、 Windows XP Starter Edition
.NET Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱系統需求一節的內容。
版本資訊
.NET Framework
支援版本:2.0、1.1、1.0
請參閱
參考
FileSystem 類別
FileSystem 成員
Microsoft.VisualBasic 命名空間
ArgumentException Class
IOException Class
FileNotFoundException Class
其他資源
RmDir 函式
ChDir 函式
CurDir 函式
Kill 函式
MkDir 函式
HOW TO:在 Visual Basic 中刪除目錄