久久―日本道色综合久久,亚洲欧美精品在线,狼狼色丁香久久婷婷综合五月,香蕉人人超,日本网站黄,国产在线观看不卡免费高清,无遮挡的毛片免费

2023信創(chuàng)獨(dú)角獸企業(yè)100強(qiáng)
全世界各行各業(yè)聯(lián)合起來,internet一定要實(shí)現(xiàn)!

在 vb 中刪除帶子文件夾的文件夾

2004-02-13 eNet&Ciweek

  Option Explicit

  Private Sub Command1_Click()

  Dim strPathName As String

  strPathName = ""

  strPathName = InputBox("請(qǐng)輸入需要?jiǎng)h除的文件夾名稱∶", "刪除文件夾")

  If strPathName = "" Then Exit Sub  

  On Error GoTo ErrorHandle

  SetAttr strPathName, vbNormal '此行主要是為了檢查文件夾名稱的有效性

  RecurseTree strPathName

  Label1.Caption = "文件夾" & strPathName & "已經(jīng)刪除!"

  Exit Sub

  ErrorHandle:

  MsgBox "無效的文件夾名稱:" & strPathName

  End Sub  

  Sub RecurseTree(CurrPath As String)

  Dim sFileName As String

  Dim newPath As String

  Dim sPath As String

  Static oldPath As String  

  sPath = CurrPath & "\"  

  sFileName = Dir(sPath, 31) '31的含義∶31=vbNormal+vbReadOnly+vbHidden+vbSystem+vbVolume+vbDirectory

  Do While sFileName <> ""

  If sFileName <> "." And sFileName <> ".." Then

  If GetAttr(sPath & sFileName) And vbDirectory Then '如果是目錄和文件夾

  newPath = sPath & sFileName

  RecurseTree newPath

  sFileName = Dir(sPath, 31)

  Else

  SetAttr sPath & sFileName, vbNormal

  Kill (sPath & sFileName)

  Label1.Caption = sPath & sFileName '顯示刪除過程

  sFileName = Dir

  End If

  Else

  sFileName = Dir

  End If

  DoEvents

  Loop

  SetAttr CurrPath, vbNormal

  RmDir CurrPath

  Label1.Caption = CurrPath

  End Sub

相關(guān)頻道: eNews

您對(duì)本文或本站有任何意見,請(qǐng)?jiān)谙路教峤?,謝謝!

投稿信箱:tougao@enet16.com