Sub RecurseTree(CurrPath As String)'currpath问文件夹路径
Dim sFileName As String, newPath As String, 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
[本日志由 admin 于 2013-11-01 10:44 PM 编辑]
引用通告地址 (0):
http://www.cnng.net/blog/trackback.asp?tbID=16
http://www.cnng.net/blog/trackback.asp?tbID=16&CP=GBK
http://www.cnng.net/blog/trackback.asp?tbID=16
http://www.cnng.net/blog/trackback.asp?tbID=16&CP=GBK