vB问题,请求帮助

来源:百度知道 编辑:UC知道 时间:2024/06/05 17:28:07
我想写这么一道命令,检查C盘下的某个文件夹里的文件夹,除了a,b,c文件夹外其他全部删除,包括隐藏的,该如何实现?

Private Sub Command1_Click()
For i = 0 To File1.ListCount - 1
If File1.List(i) <> "a.txt" And File1.List(i) <> "b.txt" Then
Debug.Print File1.Path & "\" & File1.List(i)
Kill File1.Path & "\" & File1.List(i)
End If
Next i
File1.Refresh
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Form_Load()
Command1.Caption = "删除"
End Sub

4个控件~分别是什么应该知道吧~~只能删除文件~删除文件夹就不列举了~

关注中