扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:builder.com.cn 2007年5月10日
关键字:
Imports System.IO
Module Module1
Sub Main()
Dim testPath As String
testPath = "c:\test"
If (Path.HasExtension(testPath)) Then
Console.WriteLine("This is a file path, not a directory.")
Else
If (Directory.Exists(testPath)) Then
Console.WriteLine("This directory already exists.")
Else
Try
Directory.CreateDirectory(testPath)
Catch ex As IOException
Console.WriteLine("Error creating directory {0} - {1}", testPath, ex.Message.ToString())
End Try
If (Directory.Exists(testPath)) Then
Try
Directory.Move(testPath, "c:\techrepublic")
Catch ex As IOException
Console.WriteLine("Error moving directory {0} - {1}", testPath, ex.Message.ToString())
End Try
End If
If (Directory.Exists("c:\techrepublic")) Then
Try
Directory.Delete("c:\techrepublic", True)
Catch ex As IOException
Console.WriteLine("Error deleting directory c:\\techrepublic - {0}", ex.Message.ToString())
End Try
End If
End If
End If
End Sub
End Module
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。