Private Sub btnRemovePath_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemovePath.Click
成都創(chuàng)新互聯(lián)專注于冷水江網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供冷水江營銷型網(wǎng)站建設(shè),冷水江網(wǎng)站制作、冷水江網(wǎng)頁設(shè)計(jì)、冷水江網(wǎng)站官網(wǎng)定制、小程序制作服務(wù),打造冷水江網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供冷水江網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
Try
' 先建立目錄以便用于后續(xù)的刪除示范。
If Not Directory.Exists("D:\網(wǎng)易") Then
Directory.CreateDirectory(" D:\網(wǎng)易 \Test1")
Directory.CreateDirectory(" D:\網(wǎng)易 \Test2")
Directory.CreateDirectory(" D:\網(wǎng)易 \Test3")
End If
' 刪除子目錄 Test1。
Directory.Delete(" D:\網(wǎng)易 \Test1", True)
' 刪除子目錄 Test2。
Dim myDirectoryInfo As New DirectoryInfo(" D:\網(wǎng)易 \Test2")
myDirectoryInfo.Delete(True)
' 將目錄 C:\AlexDirDemo 及其以下的文件和子目錄全數(shù)刪除。
Directory.Delete(" D:\網(wǎng)易 ", True)
Catch ex As Exception
MessageBox.Show(ex.Message)
Exit Sub
End Try
' 啟動(dòng) Windows 資源管理器。
Process.Start("explorer.exe", "D:\")
End Sub
vb.net使用控件FolderBrowserDialog1,在程序中:
'設(shè)置對話框中在樹視圖控件上顯示的說明文本
Me.FolderBrowserDialog1.Description = "請選擇輸出報(bào)表所在路徑:"
'設(shè)置從其開始瀏覽的根文件夾
Me.FolderBrowserDialog1.SelectedPath = "c:\"
If Me.FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
'取得全路徑(包含文件名)
reportPath1 = System.IO.Path.GetFullPath(Me.FolderBrowserDialog1.SelectedPath)
'設(shè)定text顯示文件名
txtReport1.Text = reportPath1
setReportList()
End If
在setReportList()中針對你所需要的文件進(jìn)行操作等
'
' 需要添加以下命名空間:
' Imports System.IO
' Imports System.Security.AccessControl
' */
Dim sPath As String = Server.MapPath(文件夾名稱字符串)
Directory.CreateDirectory(sPath)
addpathPower(sPath, "ASPNET", "FullControl")
'////////////////////////////////////////////////
Public Sub addpathPower(ByVal pathname As String, ByVal username As String, ByVal power As String)
Dim dirinfo As DirectoryInfo = New DirectoryInfo(pathname)
If (dirinfo.Attributes FileAttributes.ReadOnly) 0 Then
dirinfo.Attributes = FileAttributes.Normal
End If
'取得訪問控制列表
Dim dirsecurity As DirectorySecurity = dirinfo.GetAccessControl()
Select Case power
Case "FullControl"
dirsecurity.AddAccessRule(New FileSystemAccessRule(uername,FileSystemRights.FullControl,InheritanceFlags.ContainerInherit,PropagationFlags.InheritOnly,AccessControlType.Allow))
Exit Sub
Case "ReadOnly"
dirsecurity.AddAccessRule(New FileSystemAccessRule(username,FileSystemRights.Read,AccessControlType.Allow))
Exit Sub
Case "Write"
dirsecurity.AddAccessRule(New FileSystemAccessRule(username,FileSystemRights.Write,AccessControlType.Allow))
Exit Sub
Case "Modify"
dirsecurity.AddAccessRule(New FileSystemAccessRule(username,FileSystemRights.Modify,AccessControlType.Allow))
Exit Sub
End Select
dirinfo.SetAccessControl(dirsecurity)
End Sub
vb.net查看文件夾權(quán)限方法:
1、右鍵單擊獲取權(quán)限的文件夾,轉(zhuǎn)到安全Tab。
2、顯示了這個(gè)文件夾的權(quán)限賬戶。
3、輸入對應(yīng)賬戶的名稱與密碼即可查看全部權(quán)限信息。
網(wǎng)站欄目:vb.net文件夾管理 vb的文件管理控件是
網(wǎng)站地址:http://m.kartarina.com/article32/dogegsc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、網(wǎng)站改版、網(wǎng)站維護(hù)、網(wǎng)站建設(shè)、網(wǎng)站營銷、品牌網(wǎng)站設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)